Friday, August 3, 2012

Perl Best Practices: Regular Expressions: Always use /xms



Almost always at least.

DC explains quite well in the beginning of the section on Regular Expressions  [Link], why each of /x, /m, and /s is rather, rather reasonable to use.

  • /x : extended formatting / legibility
  • /m : let ^ and $ also match next to embedded \n; "multiline mode"
  • /s : let . also match newline; "single …"

No comments: