5

I wonder is it possible to write a regular expression for indian characters? I want to validate if the given character is an Indian letter or number. I found this two questions:

What are the unicode ranges for Hindi accented characters?

what is the range for Hindu–Arabic (ARABIC-INDIC) numeral utf8 from 0 to 9

so I tried this: \x{0600}-\x{06ff}

But if I search this text (in OpenOffice): http://pastebin.com/mDHL69XH with this: \x{0600}-\x{06ff} nothing is found...

Community
  • 1
  • 1
user568021
  • 1,426
  • 5
  • 28
  • 55
  • 1
    Different regular-expression engines are different. You say that you "want to validate if the given character is an Indian letter or number", which suggests you're using some sort of programming language, but then you say that you "search this text (in OpenOffice)", which suggests that you're trying to *test* your regex using a *different* regex engine. That is a bad idea. – ruakh Feb 13 '13 at 18:03
  • you should specify the language you are working with – Anirudha Feb 13 '13 at 18:08
  • I never really went deep into regular expressions...so different engines are new to me :) well I'm actually trying to do this in javascript... – user568021 Feb 14 '13 at 10:40

1 Answers1

11

Well this should do

[\u0900-\u097F]+// \uFFFF format supported by Java,.net

or

[\u{0900}-\u{097F}]+// \u{FFFF} format supported by perl,pcre

or

\p{Devanagari}//not widely supported
Anirudha
  • 32,393
  • 7
  • 68
  • 89