2

I use this for matching if there its '#' in beginning of word

/(?!\b)(#\S+\b)/ 

it takes everything after '#'.

But now I need to find all Arabic word who ends with "#" or for start how can I find all word end with "#"?

I try \b[A-Za-z]*#\b but dont work :(

4

2 回答 2

6

[A-Za-z] would match ASCII alphabets..You need to specify arabic unicode range to match arabic words

You can try this

\b[\u0600—\u06FF]+#(?=\s|$)

This is a pretty good reference for Arabic unicode range..


[\u0600—\u06FF] covers the complete arabic unicode range which includes digits,numeric symbols...

If you want to match arabic alphabets only use this range

[\u0600-\u065F\u066A-\u06EF\u06FA-\u06FF]
于 2013-05-17T15:41:22.563 回答
1

To match arabic word you should use only arabic alphabets.

\u0621-\u063A\u0641-\u064A\u0660-\u0669\s

Your regex would be:

\b[\u0621-\u063A\u0641-\u064A\u0660-\u0669\s]*#\b
于 2014-03-26T07:34:32.117 回答