Reputation: 3
I need a regular expression that allows letters (English and Arabic) with numbers, but not only numbers, also allows punctuates, spaces and multi-line(\n), when i searched i found this one
(?!^\d+$)^.+$
that doesn't allow multi-line.
i tried to write my own which is
(([a-zA-Zء-ي\s:-])|([0-9]+[a-zA-Zء-ي\s:-])|([a-zA-Zء-ي\s:-]+[0-9]$))*
the problem of that is :
1. it doesn't accept a number as end of string as employer9 but if it was employer9+"space" it workes fine.
2. i have to write every punctuates that is allowed, is their is a way easier to do this?
Upvotes: 0
Views: 252
Reputation: 191749
You can probably use DOTALL
or the s
modifier for the regex. You could do this with:
(?s)(?!^\d+$)^.+$
...or you could use the compiler flags when constructing the regex.
An alternative not using DOTALL
would be:
(?!^\d+$)^[\s\S]+$
Upvotes: 1