Question: Here is my code:

```
var str="<table><tr><td>abraham</td></tr></table>";

```

How to get **abraham** by matching `td` ?

I tried but failed, I don't want to match `table` or `tr`, I want to only match `td`.

```
<!DOCTYPE html>
<html>
<body>

<script>
var str="<table><tr><td>anilkumar</td>";
var patt1=/<td>(\w+)<\/td>/;
document.write(str.match(patt1));
</script>

</body>
</html>

```

It ruturns **null**.

Answer: 
Use this:

```
var str="<table><tr><td>abraham</td></tr></table>";
var result = str.match(/<td>(\w+)<\/td>/); //"abraham"
document.write(result[1]);

```

**Edit:** If you have special characters between the `td`s (like whitespace) you can use:

```
var str="<table><tr><td>abraham asd</td></tr></table>";
var result = str.match(/<td>(.*?)<\/td>/); //"abraham asd"
document.write(result[1]);

```

[**Live demo.**](http://jsfiddle.net/mgechev/5bjkP/)
This should suit your needs:

```none
<td>(.*?)</td>

```

Demo [here](http://jsfiddle.net/hUpQm/).