by Stefan » Thu Mar 15, 2007 8:49 am
Good work, Jim.
But you don't have to (group)
what you don't want to back refer to.
- - - - -
May I give an shorter example for the solution? (make an blank instead of ~)
Result gives the very last number:
(.).+~(.).+(\d)
\1~\2\3
- - -
Result gives the very first number:
(.).+~(.).+?(\d)
\1~\2\3
- - -
Result gives the whole number:
(.).+ (.).+?(\d+)
\1~\2\3
------------------
Explanation:
The ~ sign stands for: make an blank here instead of ~ sign!
The dot . means find one char.
.+ means find as many chars till there is an blank.
\d means search for numbers
\d+ means search for one or more numbers
question mark ? means find only as less as it's enough (non gready)
BTW: \s for blank signs is correct reg ex syntax, but not needed within BRU
HTH others