[Za-pm] Regular expression help needed

Oskar Pearson oskar at qualica.com
Mon Jun 23 07:55:35 CDT 2003


Hi

> I have a few regular expressions from a script that I am trying to update
> and needed some assistance with what the expression mean:
>  
> ===============================
> while(<GWTABLE>){
> next if (/^#/);
> next if (/^$/);
> $match = 1;
>  
> I'm trying to understand the second and third line.


^ means "beginning of line", $ means "end of line", this these mean:
skip the line if it starts with a # (comment character, I guess
and skip the line if it's blank.

> ===============================
> The script has this line in a few places. Can't seem to find any doco that
> would explain what it means:
>  
> s(\n)();

you can use "(" or many other characters instead of "/" in regular
expressions. This that basically means the same as s/\n///;, which
means "remove blank lines". I think that the author may be misguided there,
though, as the earlier line should have meant the same thing.

> ===============================
>  
> s/\n$//;
>  


same as above.

> ===============================
> (!/^$/)||next;
> (!/^#/)||next;


if (! blank line or comment) { next; }
(which is wierd.... I think!)

--
Oskar Pearson <oskar at qualica.com>
Qualica Technologies (Pty) Ltd
web: http://www.qualica.com/



More information about the Za-pm mailing list