From: Ammar Ali Date: 2010-11-11T16:20:18+09:00 Subject: Re: Total string length regex On Thu, Nov 11, 2010 at 5:08 AM, Shea Barton wrote: > I've actually been using rubular - but unfortunately it isn't quite as > helpful for more advanced regexes involving lookaheads / behinds etc. > > Although I found a proper regex that worked using Joel's example, a > better solution to the problem was just to use my existing regex with > validates_format_of, in conjunction with validates_size_of It's worth noting that \w and \W do not handle utf-8 properly in all cases, even with the u option. If you plan to allow/support i18n'ed usernames, consider using Unicode character properties in you regular expressions. For more information take a look at: http://ruby.runpaint.org/regexps#properties These properties are only available in ruby 1.9 though. Regards, Ammar