Im reluctant to ask but I cant figure out php preg_replace and ignore certain bits of the sting.
$string = '2012042410000102';
$string needs to look like _0424_102
The showing numbers are variable always changing and 2012 changes ever year
what I’ve tried:
^\d{4}[^\d{4}]10000[^\d{3}]$
^\d{4}[^\d]{4}10000[^\d]{3}$
Any help would be appreciated. I know it’s a noob question but easy points for whoever helps.
Thanks
Try the following:
This will match either the first four digits in a string, or the string ‘10000’ if there are three digits after ‘10000’ before the end of the string.
You would use it like this:
http://codepad.org/itTgEGo4