Rails beginner
Rails beginner

Reputation: 14504

Regex add special characters

I have this regex:

var characterReg = /^\s*[a-zA-Z0-9,\s]+\s*$/;

How do I include the letters: Å, Ø, Æ, å, ø, æ ?

Upvotes: 0

Views: 354

Answers (1)

Adam Dymitruk
Adam Dymitruk

Reputation: 129564

Use the unicode values:

\u{1234}{2}

for perl, use:

\x{1234}{2}

will match the 1234 unicode character twice.

There is much more information on this here: http://www.regular-expressions.info/unicode.html

In ruby, looks like unicode support is half-baked: http://www.ruby-forum.com/topic/133538

Upvotes: 3

Related Questions