in reply to Help constructing a regex that also matches hyphens and parentheses

I think you may be looking for a "zero-width positive lookahead" such as ([^<\/td>]) or m#...([^</td>])#; depending on your selection of regex delimiters. One of the above will match anything until a </td>.

UPDATE: Thanks, ikegami (see below). The character class is just flat wrong! But (well, actually, " And") so is the rest of my brain_spasm above this line. ...   ....argh!

You appear to have solved the issue of where to start such a match in your addendum/update, below

Replies are listed 'Best First'.
Re^2: Help constructing a regex that also matches hyphens and parentheses
by ikegami (Patriarch) on Apr 05, 2006 at 18:06 UTC

    Very wrong. The regexp you posted is neither zero-width, nor positive, nor useful. [^<\/td>]* means "Any number of characters other than <, /, t and d." It wouldn't match asdf, for example, since it contains d.

    I think you meant the zero-width negative lookahead and its common usage: (?:(?!<\/td>).)* That means "Any number of characters which don't contains the sequence </td>."

    ((?:(?!<\/td>).)*)<\/td>
    is very similar to
    (.*?)<\/td>
    but it's possible for the latter to capture much more than anticipated in some circumstances.