Q:

Regex select text and nearest wrapper

I have this text
<div>another words</div>
<div>
  some text here
</div>

I want to get <div> element which contains 'text' word. result's here:
<div>
  some text here
</div>

I can do it like this:
<div>.*text.*<\/div>

but it selects all text. 

A:

Try
<div>[^<]*text[^<]*<\/div>

To not include tags in the inner part of the match.
Also, regexp is not an ideal tool for parsing html. - Consider if your use case is better served by "proper" html parsing tools.
Edit:
If you have nested tags you are definitly leaving the area where regexp is a suitable tool.  However you might be able to use negative lookahead;
<div>(.(?<!<div>))*text(.(?<!<div>))*<\/div>

This will misbehave if you need to handle nested div's.  And probably in other edge cases, use at own risk.

