Regex for persian with numbers

c#, regex

Solution

Try to use another regex expression:

[0-9]*[\u0600-\u06FF]*

Or

[\u0600-\u06FF]*[ـ]?[\d{5}]+

Or even

[\w{Arabic}]*[ـ]?[\d{5}]+

For matching 2 groups You could use

(?'head'[\w{Arabic}]{3})[ـ]?(?'index'[\d{5}]+)

As result will be 2 groups:

head: اشک
index: 12345

Problem

I want to write a regex for these input samples: ``` اشک12345 اشکـ12345 ``` My idea: ``` "^[آ-ی][آ-ی][آ-ی][\ـ]?\d{5}" ``` But it doesn't work.

Original source