I hate regular expressions and I was hoping someone could help with a regualar expression to be used with preg_replace.
I want to strip unwanted characers from a string to return just a numeric value using preg_replace.
The string format could be as follows:
SOME TEXT £100
£100 SOME TEXT
SOME TEXT 100 SOME TEXT
Many thanks
$NumericVal = preg_replace("/[^0-9]/","",$TextVariable);
the ^ inside the [ ] means anything except the following
Edit
removed superfluous +
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With