Posts with keyword: regexp


Real-Time Regular Expressions

Grant Skinner has a nifty little regular expression tool, written in Flex, that let's you put text in one window and type regular expressions in the other and show the match. There's a "replace" tab as well for seeing how a regular expression replace would modify the text. The right side shows regexp components and describes what they do. I love it.
Continue reading {Real-Time Regular Expressions}


Detecting URLs with Regexps

Jeff Atwood talks about the problem of detecting URLs in text. The problem, as Jeff points out, is that lots of interesting characters are legal in URLs, including parens. So, writing a regular expression to distinguish between these two URLs is hard (but not impossible): My website (http://www.example.com) http://en.wikipedia.org/wiki/PC_Tools_(Central_Point_Software) Jeff's solution is pretty comprehensive and cuts the Gordian Knot of enclosing the URL in parens by removing them programatically--a good solution since we're not worried about nesting.
Continue reading {Detecting URLs with Regexps}