Brief
I'm not sure why you got downvoted so quickly, but I can only assume it's because of this question's topic and its relationship with regex match open tags except xhtml self contained tags.
By no means is this the best answer, but, in the scope of your question, it does solve your issue.
Code
See regex in use here
(?:<div[^>]*>|\G(?!\A))(?:(?!</div>).)*?\K\d{1,9}\.\d{2}
If the <div>
tag might span multiple lines, you can add the s
modifier to allow .
to match newline characters as seen here.
Results
Input
dasdfasdf 355.56 asdfasd
<div class="sdaf">sdfsad 36546545643.00 asdfa sdf sadfasdf 544.45 sadfs</div>
dasdfasdf 355.56 asdfasd
Output
dasdfasdf 355.56 asdfasd
<div class="sdaf">sdfsad 36 asdfa sdf sadfasdf sadfs</div>
dasdfasdf 355.56 asdfasd
Explanation
(?:<div[^>]*>|\G(?!\A))
Match either of the following
<div[^>]*>
Match the following
<div
Match this literally
[^>]*
Match any number of any character not present in the set (anything except >
)
>
Match this literally
\G(?!\A)
Assert position at the end of the previous match
(?:(?!</div>).)*?
Tempered greedy token matching any character any number of times, but as few as possible, and ensuring not to match </div>
\K
Resets the starting point of the reported match. Any previously consumed characters are no longer included in the final match.
\d{1,9}\.\d{2}
Match 1-9 digits, followed by a literal dot .
, followed by exactly 2 digits