regular expression is not working |
[eluser]samitrimal[/eluser]
Hi i have a problem in using dollor sign in my regular expression . When i dont use dollar sign it works fine.Here is a code Code: $pattern="/^[^0-9][0-5a-zA-Z]{1,}([a-zA-Z0-9_|-])*$/"; Code: $pattern="/^[^0-9][0-5a-zA-Z]{1,}([a-zA-Z0-9_|-$])*$/"; Code: Warning: preg_match() [function.preg-match]: Compilation failed: range out of order in character class at offset 36 in E:\wamp\www\graph\testpractice\php\regex\pregmath.php on line 3
[eluser]theprodigy[/eluser]
Quote:The error occours when i use dollor sign.The $ is a special character in Regex. Try putting a backslash before the $ in your $pattern; Code: $pattern="/^[^0-9][0-5a-zA-Z]{1,}([a-zA-Z0-9_|-\$])*$/";
[eluser]InsiteFX[/eluser]
Here is a good regular expression utility that I found! Regular Expression tester If you look at the bottom right side you can download a desktop version of it. InsiteFX
[eluser]samitrimal[/eluser]
thank u InsiteFX this tool is great and everyone . |
Welcome Guest, Not a member yet? Register Sign In |