From: C.DeRykus on
On Jun 29, 3:42 am, Sooraj S <soorajspadmanab...(a)gmail.com> wrote:
> Hi,
>
> My data file :
> -------------------
> // abc def
> //
> //    abc dser
> //
> ----------------------
> i want to remove the lines 2 and 4 from the file.
>
> check criteria : line should start with // and one or more spaces only
> as the other characters.
>
> i tried this ..  if (/^\/\/(\s)*/ ... but it shows entire lines..
>
> How to do it using regular expressions ? Is there any way to find the
> end of a word using regular expressions ?


If non-whitespace is the secondary criterion for validity:


print if m{^ // \s+ (?=.*?\S) }x; # plenken/klempen frei

--
Charles DeRykus
From: C.DeRykus on
On Jun 29, 10:07 pm, "C.DeRykus" <dery...(a)gmail.com> wrote:
> On Jun 29, 3:42 am, Sooraj S <soorajspadmanab...(a)gmail.com> wrote:
>
>
>
> > Hi,
>
> > My data file :
> > -------------------
> > // abc def
> > //
> > //    abc dser
> > //
> > ----------------------
> > i want to remove the lines 2 and 4 from the file.
>
> > check criteria : line should start with // and one or more spaces only
> > as the other characters.
>
> > i tried this ..  if (/^\/\/(\s)*/ ... but it shows entire lines..
>
> > How to do it using regular expressions ? Is there any way to find the
> > end of a word using regular expressions ?
>
> If non-whitespace is the secondary criterion for validity:
>
> print if m{^ // \s+ (?=.*?\S) }x;  # plenken/klempen frei
>

or lookahead free too:

print if m{^ // \s+ \S }x;


--
Charles DeRykus