Confusion in JavaScript RegExp ? Quantifier
Posted
by Dusk
on Stack Overflow
See other posts from Stack Overflow
or by Dusk
Published on 2010-05-06T10:44:30Z
Indexed on
2010/05/06
10:48 UTC
Read the original article
Hit count: 200
JavaScript
|regex
Hi,
May I know the reason of getting the output of the following code as: 1,10,10? Why not it is as: 10, 10?
<script type="text/javascript">
var str="1, 100 or 1000?";
var patt1=/10?/g;
document.write(str.match(patt1));
</script>
© Stack Overflow or respective owner