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: 
basically it is non-whitespace between > and <. Try, if 

> 
> >\s?(\w+)\s?<
> 
> 
> 

fulfills your needs.
You can use [`createElement`](https://developer.mozilla.org/en-US/docs/DOM/document.createElement), [`innerHTML`](https://developer.mozilla.org/en/docs/DOM/element.innerHTML), and [`textContent`](https://developer.mozilla.org/en/docs/DOM/Node.textContent):

```
var dummy = document.createElement('div');
dummy.innerHTML = str;
var text = dummy.textContent;

```

Or, using a library like jQuery (which will work better cross browser):

```
var text = $(str).text();

```

Working example of both: <http://jsbin.com/acuyoq>