Found some good info on Unicode in regular expressions: Unicode Regular Expressions. Particularly some good doco about Unicode Categories and how to indicate them in regular expressions.
Tag Archives: regex
No meta characters in regex character classes
Today while reading Writing better Regular Expressions in PHP I learned that meta characters are treated as literals in character classes. So '/^(\d[.]\d)$/'
will match '1.2'
but not '1x2'
. Who knew!?
String validation in PHP
Learn about character type checking and filter_var. I bumped into these while reading Writing better Regular Expressions in PHP.
Multilingual capitalisation regular expression (regex)
Found a cool regex over here that would find capital letters across languages. Couldn’t get it to work in JavaScript though…
^([\p{Lu}\p{Lt}]\p{Ll}+)+$
PHP Regex Pattern Modifiers
Today I needed the Pattern Modifiers documentation, particularly for ‘U’, i.e. ungreedy.
Regular Expressions (Perl-Compatible)
I found the documentation for regular expressions at php.net.
I read somewhere on the internet to use the pattern modifiers “msU” to match multiline content, but while I understand the ‘m’ and the ‘s’ I don’t understand the ‘U’ very well. I’m not sure what it means to be greedy or ungreedy exactly. But I’ve been using msU pattern modifiers in my regexps that parse the phpjs.org content for import into jsphp.co.