Template
agent-j is on the right track, but I would do something a little more restrictive:
/β¬\d+(:?[.,]\d{2})?|\d+(:?[.,]\d{2})?β¬/
The only difference is that the decimal is limited to two places, if it exists. I donβt think you want to allow something like 99,999β¬ , especially since it can mean β99 thousand, 999 eurosβ if they are written in American style.
What I think you are trying to find in your link to the cleanest and most effective way is that the above template seems uncomfortable and redundant when you look at it. Is this basically part of \d+(:?[.,]\d{2})? repeating twice with the cross sides of the symbol β¬. This seems wrong, but it is not. You cannot get around this without introducing as much complexity, if not more. Even if you try to get around this with fancy images, it will look something like this:
/^(?=.*β¬)β¬?\d+(:?[.,]\d{2})?((?<!β¬.*)β¬)?$/
Obviously, this is not an improvement. Sometimes the most obvious solution is the best, even if it makes you feel dirty.
Note. If you want to go crazy with him, you can try the option (carefully: untested, and I did not do much PHP at that time):
$inner = "(:?\d{1,3}(?:([.,])\d{3})*(?:(?!\1)[.,]\d{2})?|\d*(?:[.,]\d{2})?)";
Using:
preg_match ( "/β¬" . $inner . "|" . $inner . "β¬/", $string1, $matches)
This should also take things like 99,999,99; 999,999.99; 9.999.999.99; +0.99; and etc.