Link to home
Start Free TrialLog in
Avatar of IT Genesis
IT Genesis

asked on

Regular express validation

I need validation expression only Arabic character and Three names
Avatar of Terry Woods
Terry Woods
Flag of New Zealand image

What do you mean by three names?

Do you mean you want to match?
Charles William Harry

Open in new window

but not
Bernie Donald

Open in new window

Avatar of IT Genesis
IT Genesis

ASKER

yes two spaces i try to use thtis \w+ \w+ but not work
When using a pattern for validation purposes, you usually need to add start and end of string placeholders (^ and $) to ensure no additional characters exist before or after the characters matched by the pattern.

eg the pattern ab?d would match the value abcde but pattern ^ab?d$ would not match it.

So for 3 words separated by a space character you might want to try pattern:
^\w+ \w+ \w+$

Open in new window

yes but it run with English  character only no different  language
Then you could use this:
^[a-zA-Z]+ [a-zA-Z]+ [a-zA-Z]+$

Open in new window

Or the same thing, but shorter:
^([a-zA-Z]+ ){2}[a-zA-Z]+$

Open in new window

it also work with English letter
Sorry, you'll need to better explain what the problem is.
ASKER CERTIFIED SOLUTION
Avatar of IT Genesis
IT Genesis

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@Terry Woods

Thanks for your help