RegEx to extract URL, target and link from custom markup -
i'm sure simple, can't figure out.
i want extract url, target , link this
example: [http://www.testdomain.com/blog/122_blog post.aspx _blank]click here![/]
i have tried this:
\[(.*) (.*)\](.+?)\[\/\]
it works long have _blank
or _self
following url, if remove together, post.aspx
target (of course).
i tried things (_blank)?
, didn't work @ all.
please help, regex isn't thing, , feel free suggest other improvements. doesn't have foolproof, want keep simple.
thanks!
try this:
\[(.*?)(?: (_blank|_self))?\](.+?)\[\/\]
Comments
Post a Comment