Jump to content

[SOLVED] brain not working


ToonMariner

Recommended Posts

Need regex that allows digits '-' and ' ' but must have at least 1 digit...

 

Perhaps something along the lines of:

 

$str = '- -6';
echo (preg_match('#^[0-9 -]*[0-9][0-9 -]*$#', $str))? "$str is in the correct format!" : "$str is NOT in the correct format!";

 

?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.