We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
先上文档:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions;
正则历史:维基百科;
接下来由很浅入浅来分类学习正则基础:
元字符
量词
分支&字符集
零宽断言 (lookaround assertions)
惰性&贪婪
修饰符&标志
使用方法
例:
var myRe = /d(b+)d/g; var myArray = myRe.exec("cdbbdbsbz");
var myRe = /d(b+)d/g; var myArray = myRe.test("cdbbdbsbz");
var re = /\w+\s/g; var str = "fee fi fo fum"; var myArray = str.match(re);
var re = /\w+\s/g; var str = "fee fi fo fum"; var myArray = str.match(re); console.log(myArray); // ["fee ", "fi ", "fo "]
var re = /(\w+)\s(\w+)/; var str = "John Smith"; var newstr = str.replace(re, "$2, $1"); console.log(newstr); // "Smith, John"
var names = "Harry Trump ;Fred Barney; Helen Rigby ; Bill Abel ; Chris Hand "; var pattern = /\s*;\s*/; var nameList = names.split(pattern);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
先上文档:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Guide/Regular_Expressions;
正则历史:维基百科;
接下来由很浅入浅来分类学习正则基础:
元字符
量词
分支&字符集
零宽断言 (lookaround assertions)
从左到右/pattern的前面位置
从右到左/pattern的后面位置
惰性&贪婪
修饰符&标志
使用方法
例:
The text was updated successfully, but these errors were encountered: