Bob
I have the same level ofExpresso(I think that we have the latest) and I
have the same experience with your expression and sample text. As I amsure
you know, but for the benefit of others who might be listening in, there's
no problem if you remove the $ at the end of your expression. Which I
understand may not be the expression which you need. I would agree that it
is anExpressobug. But even so I can't imagine developing a non-trivial
regular expression without it. Have you reported this bug to Ultrapico? I
notice at the moment that the web site is down. I hope that doesn't mean
anything!
Thanks for making me aware of this.
Bob- Hide quoted text -
- Show quoted text -
I admit that this is confusing, but it is not a bug in Expresso.
Regular expressions are very literal and you have to remember that a
Windows text file has line termination characters that have to be
matched properly. Specifically, each line ends with "\r\n" (carriage
return, line feed). The regular expression in your example properly
matches each of the examples if it is all by itself without any line
termination. (Try using any of the examples as the only text in the
"Sample Text" box, without a new line). If you use a number of
examples on separate lines, it will not work, just as it would not
work in code, unless you also match the carriage return character at
the end of each line. Try this regex, for example:
^\$\d+(?:\.\d{1,2}|)\r?$
This searches for your string, matches zero or one carriage returns,
then looks for the end of the string. (Be sure to turn OFF the
"Multiline" option, which has a confusing name). It will match every
line in your example.
The "Validate Line by Line" tool was designed specifically to avoid
this confusion. All it does it to take each line individually, without
any line termination characters and apply the regex to that line,
showing whether it matches the whole line, part of it, or none of it.
If you are expecting your text to have no embedded line termination,
it is the ideal tool to use. If you want to know what will happen if
the text has carriage returns, you should use the "Run Match" tool.
This is definitely confusing, but the goal of Expresso's design is to
show you exactly what would happen if you used the regex in your code.