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? Link to comment https://forums.phpfreaks.com/topic/61683-solved-preg_match/ Share on other sites More sharing options...
shivani.shm Posted July 25, 2007 Share Posted July 25, 2007 it does not echo u "Ok". Link to comment https://forums.phpfreaks.com/topic/61683-solved-preg_match/#findComment-307045 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"; } Link to comment https://forums.phpfreaks.com/topic/61683-solved-preg_match/#findComment-307059 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. Link to comment https://forums.phpfreaks.com/topic/61683-solved-preg_match/#findComment-307173 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 Link to comment https://forums.phpfreaks.com/topic/61683-solved-preg_match/#findComment-307865 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"; } Link to comment https://forums.phpfreaks.com/topic/61683-solved-preg_match/#findComment-308114 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.