我的正则表达式很难捕捉到正确的括号集。)) group1 = matcher.group(1); }
我想要捕获一个词或在外括号内的内容在简单的情况下,这是正确的(即如果输入是union a or b;或union (union a and b) and c;,甚至是union (intersect table1 and table2)在类似的输入中,它似乎是从最后的‘和’捕获的。a and b) a
这是我到目前为止想出来的:s = 'Accounts and current portion of notes receivable, net of allowances of $2,199re.findall(r"[\$]{1}[\d,]+\.?\d{0,2}",s)['$2,199', '$2,506']
但是,我希望将原始字符串中的美元金额替换为"“。我该怎么做?