woody79 Posted July 25, 2007 Share Posted July 25, 2007 I need to do a preg_match on "h:" which is case insensitive. I have tryed this if(preg_match("/h:/i","h:Name Here")) { echo "Ok"; }else{ echo "Uh-Oh"; } This didn't work. Can someone please help me? Quote Link to comment Share on other sites More sharing options...
shivani.shm Posted July 25, 2007 Share Posted July 25, 2007 it does not echo u "Ok". Quote Link to comment Share on other sites More sharing options...
lightningstrike Posted July 25, 2007 Share Posted July 25, 2007 if(preg_match("/[h:]/i","h:Name Here")) { echo "Ok"; }else{ echo "Uh-Oh"; } Quote Link to comment Share on other sites More sharing options...
Wildbug Posted July 25, 2007 Share Posted July 25, 2007 This didn't work. Can someone please help me? Worked fine for me. Quote Link to comment Share on other sites More sharing options...
woody79 Posted July 26, 2007 Author Share Posted July 26, 2007 if(preg_match("/[h:]/i","h:Name Here")) { echo "Ok"; }else{ echo "Uh-Oh"; } That's great and all, but if you remove the "h:" it stills says ok then if you remove the "H" from Here it says Uh-Oh. I need it to test if the h: is not there Quote Link to comment Share on other sites More sharing options...
hackerkts Posted July 26, 2007 Share Posted July 26, 2007 Just remove both [ and ], if(preg_match("/h:/i","Name Here")) { echo "Ok"; }else{ echo "Uh-Oh"; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.