I have string for example: hasan عمرانی
. I want to match persian chars for the whole string. I mean if the string is not entirely persian the regex doesn't match any character.
I have this pattern so far: [\\x{0600}-\\x{06FF}\\s]+
. but it matches عمرانی
. It must not match any of the string.
please help me to provide a pattern. Thanks.
您可以使用\\p{Old_Persian}
属性而不是范围:
^\p{Old_Persian}+$
You can add ^
at the beginning of your expression and $
at the end, to try to match from the beginning to the end of the string being searched.
^[\x{0600}-\x{06FF}\s]+$
Tested it and it works on Regex101
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.