Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Regex probleme, how memorize (match)? with question mark ?

by epoptai (Curate)
on Jul 06, 2001 at 23:52 UTC ( #94582=note: print w/replies, xml ) Need Help??

in reply to Regex probleme, how memorize (match)? with question mark ?

This should match anything after mailto: that isn't a " and ends with "> and put it in $1.
if (/href="mailto:([^"]*)">/) { print "MATCH - ($1)" } else { print "DONT MATCH" }

Check out my Perlmonks Related Scripts like framechat, reputer, and xNN.

Replies are listed 'Best First'.
Re: Re: Regex probleme, how memorize (match)? with question mark ?
by tachyon (Chancellor) on Jul 07, 2001 at 00:07 UTC

    Nice regex but you don't need the trailing >. It adds nothing and will cause something that like"  > to fail. Either drop it or allow for 0 or more spaces with a \s*

    (/href="mailto:([^"]*)">/     # may fail
    (/href="mailto:([^"]*)"\s*>/  # allows legal spaces
    (/href="mailto:([^"]*)"/      # best option, just match
                                  # what we want




      True. In order to prevent legal whitespace breaking the match there's still some work left undone around the = sign:
      Of course this will still fail by only making a partial match if the email value has a double-quote (unlikely).

      Check out my Perlmonks Related Scripts like framechat, reputer, and xNN.

        And this can still fail because HREF and MAILTO: in caps are valid so we need a /i to make it case insensitive


        Are we there yet?




      All right guyz, but you forgot the second statement.
      This regex need to match :

      $_ = '<A class=Title>';

      Your RE match only if there's an "href".

      BobiOne KenoBi ;)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://94582]
[Discipulus]: oh and dont miss my last poetry!
[marioroy]: Hello all. After several attempts, am able to move forward and will soon release a Parallel:: ForkManager compatible MCE::Hobo:: Manager, also MCE::Hobo::Simple, and refactored MCE::Hobo engine supporting multiple instances. Wait works beautifully.
[marioroy]: MCE::Shared has been refined that it allows sharing Tie::File and hash objects containing {fh} key.
[marioroy]: It's taken so long to take Hobo to a new level. Threads-like and Parallel:: ForkManager management capaiblities.
[marioroy]: This will complete the 4 years in the making and likely time to move on to something els.
[marioroy]: s/els/else.

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (10)
As of 2017-05-26 08:24 GMT
Find Nodes?
    Voting Booth?