Filter by RegEx [String]¶
Description¶
Filters STRING inputs, using regular expression matching.
Input¶
SOURCE [STRING]: the list of strings to filter
Output¶
TRUE [STRING]: the strings for which the selection appliesFALSE [STRING]: the strings for which the selection does not apply
Parameters¶
Pattern RegEx: the regular expression to use for the match.Case-sensitive: if set tofalse, upper/lower case is ignored
Output scores can be aggregated and/or normalised.
Regular expressions¶
Regular expressions are internally evaluated by a PCRE engine. For a syntax reference, see this page. For a 1-page syntax reference, see this cheat-sheet.
Some of the most common questions/mistakes¶
Regular expressions are different from [glob patterns](https://en.wikipedia.org/wiki/Glob_(programming) using wildcards. In particular,
*does NOT mean “anything”,.*does.All special characters (
. * + ? | \ ( ) [ ] ^ $) must be escaped (prefixed with\) when they are meant literally, in thePattern RegEx.^indicates the beginning of an input text, or negation when used inside a multiple choice (e.g.[^\d-_]).$indicates the end of an input text.\bindicates a word-boundary (spaces, punctuation, etc.).
Examples¶
Find names in the form of
Smith, John:Pattern RegEx:\b[^,]+\s*,\s*\b\w+\b
Find any day of the week (with
Case-sensitive = false):Pattern RegEx:\b(mon|tue|wednes|thurs|fri|sat|sun)day\b