2

I have this string: "Download it from [http://wordpress.org/extend/plugins/wordpress-mobile-admin/](http://wordpress.org/extend/plugins/wordpress-mobile-admin/)";

And i'm trying to convert this markdown to actual HTML, i tried getting the matches like so:

preg_match_all('/[(.*?)]((.*?))/', $data[$toProcess], $links);
debug($links);

Yet this..did not work.

Can anyone point me in the right direction to convert this markdown into HTML.

ps. i'd rather not import the whole markdown library.

1
  • 2
    Why would you write that yourself? Use an existing library for that, e.g. this one. Commented Nov 28, 2011 at 11:17

1 Answer 1

4

You need to escape the [, ], ( and ) as they are all regex meta-characters:

preg_match_all('/\[(.*?)\]\((.*?)\)/', $data[$toProcess], $links);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.