So... I'm having a little trouble with regular expressions. I need to form a regular expression that will match this:
[a href="http://www.apple.com/"]
but not this:
[a href="http://www.apple.com/"] oogity boogity [/a] [blockquote]
.. and the result should be that the regex is that it replaces the square brackets with angle brackets of the A tags. I've come up with this /\[a(.*)\]/<a$1>/g , but it seems to match the latter first rather than the former, so it ends up replacing the wrong closing bracket. In other words, I want the regex to specifically prohibit additional closing brackets ] between the initial opening bracket [ and final closing bracket ]. How would I do this with a regular expression? (Or is it possible?)
[a href="http://www.apple.com/"]
but not this:
[a href="http://www.apple.com/"] oogity boogity [/a] [blockquote]
.. and the result should be that the regex is that it replaces the square brackets with angle brackets of the A tags. I've come up with this /\[a(.*)\]/<a$1>/g , but it seems to match the latter first rather than the former, so it ends up replacing the wrong closing bracket. In other words, I want the regex to specifically prohibit additional closing brackets ] between the initial opening bracket [ and final closing bracket ]. How would I do this with a regular expression? (Or is it possible?)