Topic: About regExp
This code:
<html>
<body>
<script type="text/javascript">
var patt1=new RegExp("e","g");
do
{
result=patt1.exec("The best things in life are free");
document.write(result);
}
while (result!=null)
</script>
</body>
</html>
Gives this result :
eeeeeenull
My question is why does it have a "null" in the end. I was also trying to get the number of "e" in the sentence "The best things in life are free" and display it like "It has x e's in this sentence" where x should be the number of letter "e". Anyone can help me on this? Thanks!
