有人知道如何在记事本++中使用正则表达式来查找阿拉伯字符吗? [英] Anyone know how to use Regex in notepad++ to find Arabic characters?
问题描述
我试图使用带有正则表达式的Notepad ++ CTRL + F来检测网页HTML中的阿拉伯字符.我输入以下内容作为搜索词,它返回所有字符.
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َبِيَّ
有什么想法为什么这个正则表达式不能正确检测阿拉伯字符以及我应该如何处理?我的文档编码为UTF-8.
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.
谢谢!
推荐答案
之所以会这样,是因为Notepadd ++正则表达式引擎是PCRE,它不支持您提供的语法.
This is happening because Notepadd++ regex engine is PCRE which doesn't support the syntax you have provided.
要匹配unicode代码点,您必须使用\x{NNNN}
,这样您的正则表达式将变为:
To match a unicode codepoint you have to use \x{NNNN}
so your regular expression becomes:
[\x{0600}-\x{06FF}]
这篇关于有人知道如何在记事本++中使用正则表达式来查找阿拉伯字符吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!