WebStorm 使用 Regex 在找到的匹配项周围添加引号

WebStorm use Regex to add quotations around found matches

给定以下数组:

R991,U847,L239,U883,L224,D359,L907,D944,L79,U265,L107

我想使用 'search and replace' 函数在字母的每个单独实例周围添加引号,后跟多个字符。

现在在搜索功能中,我可以使用 Regex 选项和 [A-Z]\d*.

定位所有实例

现在对于替换值,我如何使用某个通配符来保持相同的正则表达式值不变?

示例:

最终结果应该是:

"R991","U847","L239","U883","L224","D359","L907","D944","L79","U265","L107"

注意:作为快速修复,我搜索了每个 , 并将其替换为 ",",这几乎完全修复了它。但我想知道对于更复杂的情况,您可以使用通配符。

搜索:([A-Z]\d+)
替换为:""

https://www.jetbrains.com/help/webstorm/tutorial-finding-and-replacing-text-using-regular-expressions.html#capture_groups_and_backreference