[lug] Another sed question

Bill Thoen bthoen at gisnet.com
Sat Feb 4 16:26:50 MST 2006

On Sat, Feb 04, 2006 at 01:09:00PM -0700, Tkil wrote:
> >>>>> "Bill" == Bill Thoen <bthoen at gisnet.com> writes:
> Bill> No, I only want the records where E does not immediately follow
> Bill> the number, where the number is 1 to 3 digits long and
> Bill> immediately follows an 'R'.
> ...
> Any case with an E following only 2 digits can match (since the third
> digit is consumed as the "something that's not E" character.)  ...

Why wouldn't it look at the next character *after* the last digit and
decide if that one is E or not? That's what I thought it did.

> Excluding digits from the range give me this, which works well:
>    /^R[0-9]{1,3}([^E0-9].*|)$/

Bingo! That's got it. How wierd....

> Again, I can't recommend Freidl's book highly enough.

"Mastering Regular Expressions" sounds like a good read for anyone treading
down this road! Thanks!

- Bill Thoen

More information about the LUG mailing list