<script type="text/javascript">
var str="Jestem bardzo, bardzo zadowolony. Można powiedzieć, że jestem również uszczęśliwiony i uspokojony.";
patt1=new RegExp( "\bi\b", "g"); //<--- (to find the single word: "i")
document.write(str.match(patt1));
</script>
It works well as var pattern = /\bi\b/g;
but not when using RegExp("\bi\b","g")
. Why? (...thank you in advance)