tags:

views:

57

answers:

3

Please give me one regular expression which mathes these kind of name formats like:

1) M/S.KHALIL WARDE S.A.L.

2) Oliver Twist

The expression should allow alphabets, dot, space and / only.

thanks

A: 

Perhaps:

^[A-Za-z. /]+$

That matches uppercase A-Z, lowercase a-z, dot, space, and slash. The + means repeated one or more times (so this won't match an empty string). The leading ^ and trailing $ means the match is "anchored" to the start and end of the string, so it will check your whole string.

Greg Hewgill
You're just encouraging him or her not to try to figure things out !
High Performance Mark
I added an explanation, hopefully that will help.
Greg Hewgill
Hi Greg, I tried this and it worked ^[a-zA-Z\s\/\-\.]* .. Thanks your solution is simpler than this
Sunny
A: 

Hi

Go on, show us you've at least tried to solve this problem yourself.

Regards

Mark

High Performance Mark
A: 

What did you tried?
You can use RegexBuddy to help building regular expressions.

Zote