Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: Reguar expression

by citromatik (Curate)
on Jun 22, 2009 at 10:45 UTC ( #773566=note: print w/replies, xml ) Need Help??


in reply to Re: Reguar expression
in thread Reguar expression

That's not very complicated:

Well, maybe, but you are not asking the OP. That is: "I need a regular expression to match the following pattern.". You are using 2. (and perliff above uses 3!).

Update: Solving the problem with 2+ regexps is more or less trivial, but using just 1 is far more interesting. Here is a solution using look-ahead assertions (see perlre):

my $re = qr{ ^ # match at the beginning. (?! # Look-ahead assertion: Fail if the next matc +hes .* first # match "first" everywhere except at the begi +nning of the string ) # end of look-ahead assertion This .* \. # Match "This" (at the beginning), followed b +y anything and a dot $ # Match the end of a string. }x; # Allow these comments

citromatik

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://773566]
help
Chatterbox?
[choroba]: The previous line tells it all.
[choroba]: "Out of memory!" - anything can happen afterwards
[Discipulus]: my father sometimes gives the same result.. good fellow

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2018-02-21 13:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When it is dark outside I am happiest to see ...














    Results (280 votes). Check out past polls.

    Notices?