in reply to Re^4: regex to collect local links in Markdown
in thread regex to collect local links in Markdown

'twas the line breaks made the difference. The fix is to use [^\]]* for the match.

(. doesn't match new line characters unless you ask nicely with the /s switch.)


Perl is environmentally friendly - it saves trees

Replies are listed 'Best First'.
Re^6: regex to collect local links in Markdown
by punkish (Priest) on Oct 27, 2007 at 20:23 UTC
    indeed, you are correct. Care to explain [^\]]* instead of .*?
    --

    when small people start casting long shadows, it is time to go to bed

      . by default doesn't match \n. [^\]] matches anything, including \n, except ]. The /s switch allows . to match \n.


      Perl is environmentally friendly - it saves trees