亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

JavaScript RegExp ??

JavaScript RegExp object

RegExp: ???? ?????.

RegExp? ??????

?? ???? ??? ?? ??? ?????.

?? ???? ??? ? ??? ???? ????? ??? ??? ? ????. RegExp? ? ?????.

??? ??? ?? ??? ? ????.

? ??? ???? ? ?? ??? ???? ?? ??, ?? ??, ?? ?? ??? ? ????.

??? ? ?? ??, ??? ?? ?? ?? ??? ? ????.

Syntax

var patt=new RegExp(pattern,modifiers);

?? ? ??? ??

var patt=/pattern/modifiers;

??? ??? ??? ?????. ???? ??? ????, ???? ???? ?? ?????.

??: ???? ???? ?? ??? ???? ?? ?? ?? ????? ??(?? ????? ?)? ?????. ?? ?? ??? ?????.

var re = new RegExp("\w+");
var re = /w+/;

RegExp ???

???? ????? ???? ?? ?? ???? ???? ? ?????. ??.

i - ???? ????? ???? ?? ??? ???? ? ?????.

g - ???? ?? ??? ??? ???? ? ?????(??? ? ?? ???? ???? ?? ?? ?? ?? ??).

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</title>
</head>
<body>
<script>
var str = "Visit PHP.cn";
var patt1 = /PHP中文網(wǎng)/i;
document.write(str.match(patt1));
</script>
</body>
</html>

"is"? ?? ?? ??? ?? ? ????? ???? ?? ??

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</title>
</head>
<body>
<script>
var str="Is this all there is?";
var patt1=/is/g;
document.write(str.match(patt1));
</script>
</body>
</html>

test()

test() ???? ??? ?? ???? ??? ?? ???? true ?? false? ?????. .

?? ???? ????? "e" ??? ?????.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</title>
</head>
<body>
<script>
var patt1=new RegExp("e");
document.write(patt1.test("The best things in life are free"));
</script>
</body>
</html>

exec()

exec() ???? ????? ??? ?? ?????. ?? ?? ?? ????. ???? ??? ??? null? ?????.

?? ???? ????? "e" ??? ?????.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>php中文網(wǎng)(php.cn)</title>
</head>
<body>
<script>
var patt1=new RegExp("e");
document.write(patt1.exec("The best things in life are free"));
</script>
</body>
</html>


???? ??
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> ? <script> var str="Is this all there is?"; var patt1=/is/g; document.write(str.match(patt1)); </script> ? </body> </html>