Forum Moderators: open
var checkCells=new RegExp("(<TD.*?keyword.*?/TD>)","gi");
Two problems.
Firstly, the dot doesn't pick up on linebreaks, and the s modifier doesn't seem to be supported. For some reason, this doesn't work:
var checkCells= new regExp("(<TD[\r\n.]*?keyword[\r\n.]*?/TD>)","gi");
Secondly the regular expression is too greedy, so if it encounters a row with six cells and the keyword is in the fourth, it returns the first four. So it only seems to be being greedy on the left hand side, not the right.
Any ideas folks?
[edited by: hollow at 4:19 pm (utc) on June 25, 2004]
[edited by: DrDoc at 4:23 pm (utc) on June 25, 2004]
Then, I would modify the regular expression to something like this, which is probably closer to what you want:
var checkCells=new RegExp("(<TD[^>]*>[^<]*keyword[^<]*</TD>)","gi");
What I would ideally need is something more like this,
var checkCells=new RegExp("(<TD>(^<TD>)*keyword(^</TD>)*</TD>)","gi");
but of course this won't work either because the brackets don't work like that...
note: thanks for the <TD[^>]*> point, i've removed it from this example to keep things simple for the time being, but will add it back in when I get the rest working.
[edited by: DrDoc at 9:34 pm (utc) on June 25, 2004]
[edit reason] disabling smilies [/edit]