Jump to content

need help on regex


sandy1028

Recommended Posts

 

$Text = 2012 - A title goes on
$symbols = '`~\*\(\)\-_=\+\{\[\}\]\%\$/'

preg_match('/^[A-Z0-9\ '.$symbols.']+/', $Text, $allUpperCased);

 

Here, output is 2012 - A

 

Need help in changing the regular expression.

So that output is "2012".

 

and also should not split if text like

 

$75 or 75%

Link to comment
https://forums.phpfreaks.com/topic/266264-need-help-on-regex/
Share on other sites

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.