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

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -