1、贪婪模式
贪婪模式:在给定量词的情况下,会取最大的量词量词+和*默认就是贪婪模式var str = "1231231hello"var reg = /\d{3,6}/console.log(str.replace(reg,"*"));//1hello
2、懒惰模式
懒惰模式:在{}后面加个?号,就可以实现懒惰模式,懒惰模式是取量词中最小的量词var str = "1231231hello"reg = /\d{3,6}?/console.log(str.replace(reg,"*")); //***1231hello
