http://qs321.pair.com?node_id=872411


in reply to Re: regex match word , don't match word preceeded by slash
in thread regex match word , don't match word preceeded by slash

Hi again kcott,

I tried so many combinations I can't remember why those spaces where there ! thank you again

I'm trying to undertand

(?<![-\w./])

so the / is the one preceeding the word
but I don't get the -\w.
if someone has 2 minutes left :)

thank you too Anonymous Monk, I took a look at HTML::TreeBuilder but I wouldn't have found your solution in one afternoon ! ( is that english ? )

Have a nice day !

"There is only one good, namely knowledge, and only one evil, namely ignorance." Socrates

Replies are listed 'Best First'.
Re^3: regex match word , don't match word preceeded by slash
by kcott (Archbishop) on Nov 19, 2010 at 03:54 UTC

    In the href part, if you just have the slash in the lookbehind, the regex engine finds that gi-programming-with-perl.zip is a match and you end up with: /c<b>gi-programming-with-perl.zip</b>. By saying not a slash or any other character I'm trying to match, /cgi-programming-with-perl.zip does not match at all; the content, however, has a greater-than in that position (which is neither a slash nor a character your looking for, i.e. [-\w.]) so it does match. In my second example, the whitespace doesn't match [-\w./], so it works here also.

    -- Ken

      Thanks again :)

      "There is only one good, namely knowledge, and only one evil, namely ignorance." Socrates