[英]regular expression python that accepts everything
I want to write a re that accepts everything that is between parenthesis. 我想写一个re,接受括号之间的所有内容。 My re is: r''\\'([^&]+'\\')' (ingnore the '' in the backslash)
我的回复是:r''\\'([[^&] +'\\')'(反斜杠中的``)
I had to put that random character so it will accept everything except that. 我必须放置一个随机字符,以便它可以接受除此以外的所有内容。 How can I write it so it accepts EVERYTHING including that character.
我该怎么写,以便它接受包括该字符在内的所有内容。 Thanks.
谢谢。
How about: 怎么样:
r'\([^)]+\)'
Because you don't want to accept the close parenthesis. 因为您不想接受右括号。
Also: 也:
(Dot.) In the default mode, this matches any character except a newline.
(点)在默认模式下,它匹配换行符以外的任何字符。 If the DOTALL flag has been specified, this matches any character including a newline.
如果指定了DOTALL标志,则它匹配包括换行符在内的任何字符。
So: 所以:
r'\(.+\)'
Might be what you are looking for. 可能是您要寻找的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.