Re: reg expr...

"Sarah Thompson" <>
11 Sep 2002 23:22:36 -0400

          From comp.compilers

Related articles
reg expr... (Shoaib Ali BURQ) (2002-09-08)
Re: reg expr... (Gwyn Judd) (2002-09-11)
Re: reg expr... (Sarah Thompson) (2002-09-11)
Re: reg expr... (Torben Ægidius Mogensen) (2002-09-12)
| List of all articles for this month |

From: "Sarah Thompson" <>
Newsgroups: comp.compilers
Date: 11 Sep 2002 23:22:36 -0400
References: 02-09-040
Keywords: lex
Posted-Date: 11 Sep 2002 23:22:36 EDT

> I'm looking for a regular expression that say:
> match the line that does not begin with the string {s}
> now the way i see it ... if my s = "abc" then i will have to look for
> (a & b) or (ab & not c) or (abc & not wht_spc) ...
> but the longer the s the longer the reg expr ... is there another way to
> do this?

For the case where {s} is 'fruitbat', the regex:


should work, assuming the whole input is one line. The first term will
match any line of 8 or more characters, where the first 8 characters
are not 'fruitbat'. The second term picks up the other possible valid
lines, which are any combination of up to 7 characters.

Using POSIX syntax for line start/end matching and assuming input
containing multiple lines, something like:


should do the trick.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.