Last update:   29-10-2021


In Perl regex, \b normaly matches a word boundary. But, withing a character class, \b matches a backspace. Generic Whitespace    (2/4)

Generic whitespace

Is a shorthand for a whole character class - any {{whitespace character. This includes space, tab, newline, and carriage return. Modifier Case Insensitive    (3/4)

Modifier case insensitive

The add i in m/../i instructs Perl to do the match in a case-insensitive manner. It's not acctualy part of the regex, but part of the m/../ syntatic packaging. Shorthands    (4/4)


Among the more useful shorthands that Perl provide are:
\t    // a tab character

\n    // a newline character

\r    // a carriage-return character

\s    // any whitespace character (space, tab, newline)

\S    // anything not s

\w    // [a-zA-Z0-9_]+ match a word with w+ 

\W    // [^a-zA-Z0-9_]+ anything not w 

\d    // [0-9] a digit

\D    // [^0-9] anything not d
... 4 lines

Search and replace

        A B C D E F