test是RegExp的方法,参数是字符串,返回值是boolean类型. match是String的方法,参数是正则表达式,返回值是数组. <script type="text/javascript"> var str="javascript is good,java"; console.log(str.match(/java/gi)); //返回时数组 </script> var str="javascript is good,j
search ⇒ find something anywhere in the string and return a match object. match ⇒ find something at the beginning of the string and return a match object. # example code: string_with_newlines = """something someotherthing"""