[英]What is the best python regular expression to exclude only a single instance of a comma between a pair of curly brackets?
If the line contains more than one comma, I want it returned.如果该行包含多个逗号,我希望它返回。
For example, in the following lines I want to return all the lines except {,}
.例如,在以下几行中,我想返回除{,}
之外的所有行。
{,,,}
{abskdjf}
{,}
Can't you just match on that exactly?你不能完全匹配吗? For example in Python if the text was a variable called text then re.sub(r"{,}", "", text)
例如在 Python 中,如果文本是一个名为 text 的变量,那么re.sub(r"{,}", "", text)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.