January 11th, 2013, 10:21 AM
Regex matching characters unless they're at the end of a string
Not sure how to explain this, but here it goes.
could contain a string followed by none, one or multiple dots:
Using regex I'm looking for any invalid characters in $val and then I want to replace them.
$inv is an array of invalid entries, this also includes a dot.
How do I strip all $inv characters from $val EXCEPT any dots on the end? eg:
if $val = te%st... the correct result should be testů
if $val = te.est. the correct result should be test.
Hope that makes sense. Thanks.
January 11th, 2013, 11:12 AM
what about a "mixed" sequence of invalid characters at the end like in
Will the "%" be kept?
If yes, then simply replace all sequences of invalid characters with a valid character following:
January 11th, 2013, 11:16 AM
% is coming from $inv, that needs to be removed as do any dots unless they are at the end
January 11th, 2013, 11:43 AM