> Basically valid formats would be: > $123 > $ 123 > 123$ > 123 $ This would suggest to me something like: $CurrencyRegex = '$|foo|bar|baz'; $AmountRegex = '[\d.]+'; $prefixed = qr/ ($CurrencyRegex) \s* ($AmountRegex) /x; $postfixed = qr/ ($AmountRegex) \s* ($CurrencyRegex) /x; ($currency, $amount) = $input =~ $prefixed or reverse $input =~ $postfixed; (Sorry if some syntax or escaping is wrong.) Also, try adding: use re "Debug";
- Interesting? regexp Aaron Craig
- Me