Earlier quoted context omitted.
Good question. The regex I tried is for extracting amounts in EUR and USD: / (? (? €|EUR|\$|USD ) [ \t]? )? (? (? -? \d{1,3} (?:[\.,]\d{3}|\d*) ) [\.,] (? \d{2,3} ) ) (? [ \t]? (? (? €|EUR|\$|USD ) ) | (? [ \t]|$|\n ) )/x
I'd imagine many nested named capturing groups may trip even the best automated system! I do like the solution though. I would've probably approached it differently, trying to first get the 'inverted' match (i.e. ignore anything that isn't a currency-like pattern) and refine from there. A bit like this one I did a while back, to parse garbled strings that may occur after OCR [0]. I imagine the approach does not trans…
The idea of an exclusionary approach sounds interesting as well. I'll have to think about that a bit.