User:KuduIO/Regex


 * (Question)
 * Here is a non-exhaustive description of what a regex is:
 * The term "regex" (sometimes "regexp") is an abbreviation of regular expression. It's a way to match patterns within strings. Most of the time, patterns are delimitated by slashes, although not in edit filter syntax.
 * The pattern  will match "cat", but not "dog". You can also use anchors in a regex -   means the beginning of the string and   means the end. The following characters have special meanings:   To take their literal form as a character, they will need to be escaped with a backslash. To match "What?", you'll have to use the pattern.
 * A "character class" matches only one out of several characters, using the form, which will match vowels. The negated form is  . There are several built-in classes available, such as   for word characters,   for word boundaries,   for whitespace and   for digits. The negated form is, for example,   for non-digits. The   is the or operator (e.g.   matches "foo" or "bar"). You can use special character sequences to put non-printable characters in a regex:   for a tab character,   for newline and   for carriage return.   inserts the character at the specified hexadecimal index.   inserts a Unicode character.
 * The dot matches any single character, except a newline. It is short for  . The question mark makes the preceding token optional (e.g.   will match "flavor" and "flavour"). The asterisk makes the pattern attempt to match the preceding token zero or more times. The plus matches once or more. Curly braces specify a specific amount of repetition (e.g.   will match 1 to 3 as).
 * The quantification operators are greedy, meaning that they will consume as much of the pattern as possible. The pattern  will match " test" in "This is a test". Placing a question mark after the quantifier makes it lazy.   will then match .
 * Tokens can be grouped together by surrounding them with parentheses. You can then apply a quantifier to the group (e.g.  matches "foo" or "foobar"). You can then make backreferences to the group (e.g.   will match "aca" or "bcb"). The syntax   produces a non-capturing group, which is more efficient if one isn't going to use the group's contents.