[PLUG] simple grep/regex question
Paul Heinlein
heinlein at madboa.com
Mon Apr 14 18:58:35 UTC 2008
On Mon, 14 Apr 2008, Galen Seitz wrote:
> I'd like to match all occurrences of a given word that are not
> preceded at any point by a particular character. Specifically, I want
> to match all occurrences of the word 'bit' that are not in an assembly
> language comment, where the comment character is ';'. For example, I
> want to match the second line, but not the first.
>
> sacl mode,2 ; set mode bit2=1 to SCS
> bit my_settings,bit11 ; am I articulated?
>
> I've tried these:
> grep '[^;]*bit' foo.asm # matches all bit
> grep '[^;]+bit' foo.asm # matches nothing
Would it ever happen that 'bit' could appear multiple times on a
single line, both in the code and in the comments?
--
Paul Heinlein <> heinlein at madboa.com <> http://www.madboa.com/
More information about the PLUG
mailing list