View Full Version : Regex to get text between tags

10-17-2006, 12:17 AM
hi guys,

is it possible to extract only the text between the two tags in the following string, with a regex?

"<td>John Doe</td>"

thanx for the help :)

10-17-2006, 12:33 AM
Well i found a solution myself. I dont know if its the better, but at least is one.

var reg = /[^(<td>)].+[^(</td>)]/;

if anyone has a better solution, please let me know!

Philip M
10-17-2006, 08:51 AM
or var reg= /<td[^>]*>(.*)<\/td>/i;