有人知道如何在记事本++中使用正则表达式来查找阿拉伯字符吗? [英] 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屋!