dreamwest Posted September 22, 2010 Share Posted September 22, 2010 Im trying to match this string, but i dont wat to match normal words like "hello world 646" $string = "2ab055843241f20044af82ae0d5ace04"; //always over 15 chars - without spaces if ( preg_match('~^[0-9\s]+$~D', $string)) { echo 'yes'; } If i can do it with preg_match that would be great Link to comment https://forums.phpfreaks.com/topic/214077-preg_match/ Share on other sites More sharing options...
btherl Posted September 22, 2010 Share Posted September 22, 2010 Try this: preg_match('~^[0-9a-f]{32}$~', $string) I'm assuming you want 32 hexadecimal digits Link to comment https://forums.phpfreaks.com/topic/214077-preg_match/#findComment-1113984 Share on other sites More sharing options...
dreamwest Posted September 22, 2010 Author Share Posted September 22, 2010 cool! I never would have figured it out Thanks Link to comment https://forums.phpfreaks.com/topic/214077-preg_match/#findComment-1113988 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.