Re: multilinepattern match

From: Sara (genericax_at_hotmail.com)
Date: 11/17/03


Date: 17 Nov 2003 10:42:37 -0800


"Sunil" <sunil_franklin@hotmail.com> wrote in message news:<Np%tb.1$U71.32@news.oracle.com>...
> Hi,
> I have to match a string like
>
> "end;
> /"
>
> in a file. Any suggestions on how to do this?
>
> Thanks,
> Sunil.

look at the "s" and "m" switches in perl regexes, for starters they
are very useful for multiline inputs.

On this other hand you can do this match with no switches:

#!/usr/bin/perl -wd
$_ = "a bunch of
stuff
is here..
end;
/
thats all
folks";

print "Eureka!\n" if /end;\n\//;

 ************************************************************************

I guess would be one way?

-G



Relevant Pages

  • Re: i am being cyber stalked
    ... >> the hacker opend a website about me with out my presmission ... > thats it, you've given someone a bit of string to pull on. ...
    (microsoft.public.security)
  • Re: Sad
    ... Kind of easy to pick out the folks in this string of posts who have never ... been in a caregiver role. ...
    (rec.woodworking)
  • Re: .99999... still=/= 1
    ... back to the old format, which is good, since ... it was impossible to see the "tree" in "v2." ... the main point is that the folks ... of a very long string of 9s. ...
    (sci.math)
  • Re: New Song - Heaven Knows
    ... Thats one helluva an oustanding song - and oustanding lyrics too. ... I can imagine a nice string section in there somwhere too. ...
    (alt.guitar.beginner)
  • Re: Validation
    ... Yes - A bit awkward to use try/catch for regular logic flow but thats the way ... > block to determine if it is an int. ... Also, it returns a string already, so there is no need ...
    (microsoft.public.dotnet.framework.aspnet)