Reputation: 31
Regex dons't include number:98,10 why?
<script>
var s = "asd asd 97 sasd3 54 asd98asd 10sasdal334";
document.write(s,"<br> 2 digit numbers: ",s.match(/\b[0-9]{2}\b/gm));
</script>
Upvotes: 0
Views: 55
Reputation: 4887
It does not include 98 and 10 because you use: \b
\b
... Assert position at a word boundary (position preceded or followed—but not both—by an ASCII letter, digit, or underscore)
Upvotes: 1