February 2008
Intermediate to advanced
216 pages
4h 33m
English
Most forum and blog software automatically convert URLs in posts and comments into hyperlinked text. You could probably think of a simple way to implement this feature in your own site by matching http:// and then using a backreference to add an anchor tag around it. However, what if someone is actually using an anchor tag? Then you'd get a real mess!
Therefore, you need to think of a way to make sure that the URL is not already inside an anchor tag. You might think of using the grouping modifier ?!, which says reject anything that matches this group. However, this works in a regular expression only if the unwanted group follows what you want to match, because of the way regular expressions work—they consume ...
Read now
Unlock full access