views:

15

answers:

1

I want to validate a field which will allow only "xxxx"[not " " or "xxxx"" or somthing else] with regular expression in Jquery validator ,so what the regular expression would be...plzz suggest.

A: 

A general regex you should match would be -

^"[x]+"$

(I assume you only want character 'x' as you defined in question and x does not mean 'any character' )

Edit: As per your comment here is the modified regex you should be using -

^"[^"]+"$
Gopi
Arko
Edited my answer for same
Gopi
ok i will try that..and thanx
Arko
i guess this is not working..earlier i was using /^[a-z0-9_ *-]+$/ this regex,now i just want to add the validation i have already mentioned.wat to do?
Arko
This is not different than your earlier regex except for addition of quotes. I am not sure why this is not working in your case probably it may require some escaping of quote by prefixing it with '\'.
Gopi