I'm doing a regular expression for a linking system, and the syntax looks like this:
<a href=":login">Login</a>
This tells the system that this link should be converted to JS or an HTML destination depending on the user's browser capabilities.
Right, so I have all the back-end stuff working fine, but I noticed a strange problem with the regular expresion that I'm using to catch these types of links. When a dynamic link (href=":) stands by itself (i.e. not next to another object) then it works fine; however, if a dynamic link like
<a href=":myLink">
comes after a standard link like
<a href="myLink">
then the dynamic link doesn't get altered, like it should.
Here is a codepad link to some sample code that demonstrates the bug. http://codepad.org/ZKdm2NkS
Notice the <a href=":first">
link does not get modified but the <a href=":second">
link does.
I'm not very good with regexps so I'm sure there's a better way of handling things rather than just using a (.*)
everywhere you turn, but like I said, I'm open to better ideas and opinions.