partha Posted January 4, 2007 Share Posted January 4, 2007 Hai Friends,I want to get some input from user. It may be more than one word.In eregi(), i am not able to accept the white space.if (!eregi("^[(0-9a-z_)]+[(0-9a-z)]$", $name)){ echo ("Invalid");}I have tried, /s*, /s+ and many more. But, no use.I hope, friends can help me.Thanks and regards,T.R.Parthasarathy Link to comment Share on other sites More sharing options...
jesh Posted January 4, 2007 Share Posted January 4, 2007 In regular expressions, special characters are escaped with a back-slash (\) rather than a forward-slash (/).Have you tried "\s"? Link to comment Share on other sites More sharing options...
partha Posted January 5, 2007 Author Share Posted January 5, 2007 I am using PHP. I have referred so many sites and i have tried it. But, i did not get the result. In regular expressions, special characters are escaped with a back-slash (\) rather than a forward-slash (/).Have you tried "\s"? Link to comment Share on other sites More sharing options...
partha Posted January 8, 2007 Author Share Posted January 8, 2007 Hi,Thanks,I am using PHP. I have used backslash, forward slash, and * + and so many.But, I did not any +ve results.Can u help me by sending correct code.Thanks and regards,T.R.Parthasarathy. Hai Friends,I want to get some input from user. It may be more than one word.In eregi(), i am not able to accept the white space.if (!eregi("^[(0-9a-z_)]+[(0-9a-z)]$", $name)){ echo ("Invalid");}I have tried, /s*, /s+ and many more. But, no use.I hope, friends can help me.Thanks and regards,T.R.Parthasarathy Link to comment Share on other sites More sharing options...
justsomeguy Posted January 8, 2007 Share Posted January 8, 2007 Try using [[:space:]] to specify whitespace. Or, you can just use the space character in the character class.if (!eregi("^[(0-9a-z_ )]+[(0-9a-z)]$", $name)) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now