regular expression example
Example 1: regex examples
\d matches a single character that is a digit -> Try it!\w matches a word character (alphanumeric character plus underscore) -> Try it!\s matches a whitespace character (includes tabs and line breaks). matches any character -> Try it!
Example 2: regex examples
a(bc) parentheses create a capturing group with value bc -> Try it!a(?:bc)* using ?: we disable the capturing group -> Try it!a(?<foo>bc) using ?<foo> we put a name to the group -> Try it!
Example 3: regex examples
[abc] matches a string that has either an a or a b or a c -> is the same as a|b|c -> Try it![a-c] same as previous[a-fA-F0-9] a string that represents a single hexadecimal digit, case insensitively -> Try it![0-9]% a string that has a character from 0 to 9 before a % sign[^a-zA-Z] a string that has not a letter from a to z or from A to Z. In this case the ^ is used as negation of the expression -> Try it!
Example 4: regex examples
a(b|c) matches a string that has a followed by b or c (and captures b or c) -> Try it!a[bc] same as previous, but without capturing b or c
Example 5: regex examples
\$\d matches a string that has a $ before one digit -> Try it!
Example 6: regex examples
\D matches a single non-digit character -> Try it!