sample regex patterns code 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!

Tags:

R Example