Regular Expressions in Ruby

January 17, 2012 · Posted in Development · Comment 


Ruby uses Perl-compatible regular expressions, so if you’re familiar with the preg_*functions in PHP, it will be easy to learn regular expressions in Ruby.

Read more

Working with regular expressions (preg_) and UTF-8 strings in PHP

December 17, 2011 · Posted in Development · Comment 

Regular expression patterns \w, \d, \s will not work as expected for non-latin letters in a UTF-8 string when you use preg_ functions (like preg_match, preg_split, preg_replace).

First of all you must use modifier /u to work with UTF-8 strings correctly.

One of the best solutions to common tasks is to use the pattern escapes \P, \p, and \X, which refer to Unicode character properties.

Read more