PHP class to query the web by an SQL like language
jonasjohn.de
jonasjohn.de
In fact, the invalid case is exactly why you'd use this technique. If you use a bunch of regular expressions, you can probably make something that works on a subset of valid inputs. If you want it to work on everything, then you need to use a parser to generate a DOM, and then interact with the DOM.