[英]Sublime text regex find/replace not recognising regex
I have to find/replace A LOT of inputs in a lot of files that have name and are either required or have minlength/maxlength or ng-pattern attribute. 我必须在许多具有名称且需要或具有minlength / maxlength或ng-pattern属性的文件中查找/替换大量输入。
I made this regex: 我做了这个正则表达式:
<input([^\/\>]*?) name="([\S\_]+?)" ([^\/\>]*?)(required|pattern|minlength|maxlength)([^\/\>]*?)\/\>
I tested this regex on regex101.com (as a js regex though) and it works. 我在regex101.com上测试了这个正则表达式(虽然作为js正则表达式)并且它有效。 Sublime probably has slightly different regex syntax than javascript, but I've been using regex find/replace a lot recently, and this is the first time it's not working.
Sublime可能与javascript略有不同的正则表达式语法,但我最近一直在使用正则表达式查找/替换,这是它第一次无效。
I'm pretty sure it's these parts that are problematic: 我很确定这些部件是有问题的:
([^\/\>]*?)
Any help would be appreciated. 任何帮助,将不胜感激。
<
and >
don't need to be escaped. <
和>
不需要转义。 So don't escape your the last character ie change \\>
to >
所以不要逃避你的最后一个角色,即改变
\\>
到>
<input([^\/\>]*?) name="([\S\_]+?)" ([^\/\>]*?)
(required|pattern|minlength|maxlength)([^\/\>]*?)\/>
^ Don't escape
instead of 代替
<input([^\/\>]*?) name="([\S\_]+?)" ([^\/\>]*?)
(required|pattern|minlength|maxlength)([^\/\>]*?)\/\>
^ Doesn't WORK in sublimetext
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.