Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

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

by epoptai (Curate)
on Jul 07, 2001 at 00:21 UTC ( #94593=note: print w/replies, xml ) Need Help??


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

True. In order to prevent legal whitespace breaking the match there's still some work left undone around the = sign:
/href\s*=\s*"mailto:([^"]*)"/
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.

  • Comment on Re: Re: Re: Regex probleme, how memorize (match)? with question mark ?
  • Download Code

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

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

    /href\s*=\s*"mailto:([^"]*)"/i

    Are we there yet?

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      I can see two improvements toward making it bulletproof:

      1. you never know when someone will use single quotes
      2. or linebreaks

      In this kind of golf the code tends to get longer 8^}

      /href\s*=\s*["']mailto:([^"']*)["']/si

      Someone should mention HTML::Parser.

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

        Hmm, good additions. I'm trying to think of new additions

        Thinking, please wait.......................................
        ............................................................
        ............................................................
        ............................................................
        ............................................................
        ............................................................
        ............................................................
        ............................................................
        ............................................................
        ............................................................
        ............................................................
        .................Ctl-Alt-Del

        Endless loop, I might have to go and read the tag specs!!

        BTW If you just say use HTML::Parser you would ruin all this fun so best we keep it a secret :-)

        cheers

        tachyon

        s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

        Thank epoptai,
        but there no need to had more stuff :o)
        It's harder enough to match the two strings...
        I know exactly what I can find, in this case. NO simple quote, neither breakline... :o)

        I tried something with HTML::Parser, but I DEFINITLY don't undestand HOW IT WORKS... Neither examples in perldoc or examples found in PerlMonks enlight me.

        So maybe you can explain me...
        First I initialize a object, OK ! Then I have got 3 functions "start", "end" ... what's for ?
        What does the function $p->parse() ?
        How can I print parse result ?

        BobiOne The losted Man :-/

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://94593]
help
Chatterbox?
[LanX]: which means albeit being broken UTF8 it'll be handled correctly
[LanX]: and the problem only occurs since we changed the emails to base64
[LanX]: my main problem will be to cnvince my colleagues that our productive code is broken oO ... so in the end I will just make a workaround :-/
LanX hates UTF8 for causing knots in his brain and stomach
[Corion]: LanX: Yes, that's the main problem - you have lots (and lots) of workarounds in various places and stages of the processing, and to clean that mess up requires action across the complete codebase. And it's almost impossible to do it piece-by-piece

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2017-01-16 14:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (150 votes). Check out past polls.