Hi all…
I’m looking for a regex pattern that would return true for a string like this:
$argument = "FNB :-) R350.00 paid to cheq a/c..887782 @ Metlife ATM.Ref.1198garfield. 29Dec 11:06";
I found a pattern to test against the actual currency, but not within a string:
$regex = /^[+-]?[0-9]{1,3}(?:[0-9]*(?:[.,][0-9]{2})?|(?:,[0-9]{3})*(?:\.[0-9]{2})?|(?:\.[0-9]{3})*(?:,[0-9]{2})?)$/;
Is there any 100% working and tested regex pattern that can be used for the above string?
I’m currently using a workaround, like so:
$amount = $argument.split(' ');
console.log($regex.test($amount[2]));
It works, but all hell breaks loose if that text formatting (the payment notification) were to change (my system is relying, depending, on that format! Really unstable I know…that’s why I was thinking Regex)