sandy1028 Posted July 26, 2012 Share Posted July 26, 2012 $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% Quote Link to comment https://forums.phpfreaks.com/topic/266264-need-help-on-regex/ Share on other sites More sharing options...
requinix Posted July 26, 2012 Share Posted July 26, 2012 Yeah... You'll have to explain what you're trying to do. Quote Link to comment https://forums.phpfreaks.com/topic/266264-need-help-on-regex/#findComment-1364501 Share on other sites More sharing options...
peipst9lker Posted July 26, 2012 Share Posted July 26, 2012 Is every $Title in that format? If yes just substr the first 4 letters? Else try this one: ^([0-9]+) Quote Link to comment https://forums.phpfreaks.com/topic/266264-need-help-on-regex/#findComment-1364503 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.