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
脚本语言(js/py/php/...)里面基本都内置支持了正则表达式,处理字符串能力极其强大,并且平时编辑器里面也有支持正则表达式的操作(见 #242,编辑器支持正则查找/替换)。
今天在看 Fiddler 的重定向(见 #247),里面使用了 .net 语法的正则表达式,就过去看了下。里面有 ES6 就要支持的捕获到变量名(不支持叫什么,就是之前都是 $0, $1, $2, ..., 现在可以 (?<var>...) 这样, 然后在正则中可以 \k<var> 这样引用, 在 JavaScript 中使用 group.var 引用变量,在 replace 中使用 $<var> 引用, 以及 replace(reg, function(m, p1, p2, i, string, object) {} 使用),还有 (?<=... 和 (?<!...) 环视。各种语言都差不多...
(?<var>...)
\k<var>
group.var
$<var>
replace(reg, function(m, p1, p2, i, string, object) {}
(?<=...
(?<!...)
ES6 里面支持了 y u s 修饰符,
y
u
s
.
\n
感觉像正则表达式一样性价比高的还有各种配置文件格式/解析 - 比如: markdown/hosts/yaml/ini... 如果熟悉之后,再各种场景都可能会用到...
🚰
The text was updated successfully, but these errors were encountered:
No branches or pull requests
脚本语言(js/py/php/...)里面基本都内置支持了正则表达式,处理字符串能力极其强大,并且平时编辑器里面也有支持正则表达式的操作(见 #242,编辑器支持正则查找/替换)。
今天在看 Fiddler 的重定向(见 #247),里面使用了 .net 语法的正则表达式,就过去看了下。里面有 ES6 就要支持的捕获到变量名(不支持叫什么,就是之前都是 $0, $1, $2, ..., 现在可以
(?<var>...)
这样, 然后在正则中可以\k<var>
这样引用, 在 JavaScript 中使用group.var
引用变量,在 replace 中使用$<var>
引用, 以及replace(reg, function(m, p1, p2, i, string, object) {}
使用),还有(?<=...
和(?<!...)
环视。各种语言都差不多...ES6 里面支持了
y
u
s
修饰符,y
每次匹配是都认为 lastIndex 是开头u
支持了 unicode 字符s
用来完善.
不支持\n
的不足感觉像正则表达式一样性价比高的还有各种配置文件格式/解析 - 比如: markdown/hosts/yaml/ini...
如果熟悉之后,再各种场景都可能会用到...
🚰
The text was updated successfully, but these errors were encountered: