View Full Version : Regex to get text between tags

10-16-2006, 11:17 PM
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-16-2006, 11:33 PM
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, 07:51 AM
or var reg= /<td[^>]*>(.*)<\/td>/i;