如何在notepad ++中提取方括号之间的逗号? [英] How to extract commas in between square brackets in notepad++?
本文介绍了如何在notepad ++中提取方括号之间的逗号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
例如:
[TEXT1,TEXT2,TEXT3]
我的表达:[\[].*,.*[\]]
查找带有逗号的字符串(在方括号之间),但我只想明确匹配方括号中存在的逗号.
Finds strings with commas (in between brackets,) but I only want to explicitly match the comma that exists in the square brackets.
我需要用空格替换逗号 - 但只能在方括号中.
I need to replace the commas with spaces - but only in the square brackets.
我试过 [\[],[\]]
但这不起作用 -
I've tried [\[],[\]]
but that doesn't work -
\[(.*?)\]
也会找到中间的文本 - 但我不想要整个字符串.
\[(.*?)\]
will find the text in between as well - but I do not want the entire string.
谁能建议我需要做什么才能在括号之间找到逗号?
Can anyone suggest what I need to do to just find commas in between the brackets?
推荐答案
查找内容:
(?:\[|(?!^)\G)[^,\]]*\K,
替换为:
空格
细分:
(?:\[|(?!^)\G)
匹配开头的[
或 最后一场比赛结束(?!^)\G
.[^,\]]*
消耗所有字符直到下一个逗号.\K
告诉正则表达式引擎 丢弃到目前为止匹配的内容.,
最后匹配逗号.
这篇关于如何在notepad ++中提取方括号之间的逗号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文