[英]replace regular expression in sublime text
I have application where few labels are written like 我有写很少标签的应用程序
ui-label-Display Not Masked
Now I want to replace it by 现在我要替换为
ui-label-Display_Not_Masked
so i have written search regex by 所以我写了搜索正则表达式
ui-label-(\w+ )*
This searches all expression but I am not able to create a expression to replace this text as required. 这会搜索所有表达式,但是我无法创建表达式来根据需要替换此文本。 I have written one regex 我写了一个正则表达式
$1_
which replaces 取代
ui-label-Display Not Masked
by 通过
ui-label-Display Not_Masked
This cannot be done with a single regex in a single iteration. 这不能在单个迭代中使用单个正则表达式来完成。 You have two choices: 您有两种选择:
(ui-label-\\w+)
(note the space at the end) with $1_
until it no longer matches anything. 用$1_
替换(ui-label-\\w+)
(注意末尾的空格),直到不再匹配任何内容。 (ui-label-\\w+) (?:(\\w+)(?: (\\w+))?)?
用必要的捕获组制作一个长整型正则表达式,即(ui-label-\\w+) (?:(\\w+)(?: (\\w+))?)?
and replace with $1_$2_$3
. 并替换为$1_$2_$3
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.