Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anyone know how to use Regex in notepad++ to find Arabic characters?

I am trying to detect Arabic characters in a webpage's HTML using Notepad++ CTRL+F with regular expressions. I am entering the following as my search terms and it is returning all characters.

[\u0600-\u06FF]

Sample block of random text I'm working with -

awr4tgagas
بqa4tq4twْq4tw4twtfwd
awfasfrw34جَ4tw4tg
دِيَّة عَرqaw4trawfَبِيَّ

Any ideas why this Regular Expression won't detect the Arabic characters properly and how I should go about this? I have the document encoded as UTF-8.

Thanks!

like image 848
0xhughes Avatar asked Aug 23 '13 21:08

0xhughes


2 Answers

This is happening because Notepadd++ regex engine is PCRE which doesn't support the syntax you have provided.

To match a unicode codepoint you have to use \x{NNNN} so your regular expression becomes:

[\x{0600}-\x{06FF}]
like image 170
Ibrahim Najjar Avatar answered Oct 19 '22 09:10

Ibrahim Najjar


Because Notepad++'s implementation of Regular Expressions requires that you use the

\x{NNNN}

notation to match Unicode characters.

In your example,

\x{0628} 

can be used to match the ب (bāʾ,bet,beth,vet) character.

The \u symbol is used to match uppercase letters.

See http://sourceforge.net/apps/mediawiki/notepad-plus/index.php?title=Regular_Expressions#Ranges_or_kinds_of_characters

for an explanation of Notepad++'s regex syntax.

like image 37
Rob Raisch Avatar answered Oct 19 '22 09:10

Rob Raisch