1
RIcter 2015-01-31 23:37:05 +08:00 via iPad 1
\s\S
|
2
inevermore OP @RIcter 解决了,为啥 . 和 \s组合不管用?
|
3
RIcter 2015-01-31 23:55:34 +08:00 via iPad
@inevermore \S是各种空白字符,比如\n\t之类的,而\s是^\S
|
4
sneezry 2015-02-01 00:00:45 +08:00
楼主问题之外,div用非贪婪是不是更好一点?
|
5
SolidZORO 2015-02-01 00:47:44 +08:00 2
<div(.|\n)*</pre>
匹配包含\n在內的任何字符用 (.|\n)。 |
6
lujjjh 2015-02-01 02:26:59 +08:00 via Android
re.S
re.DOTALL Make the '.' special character match any character at all, including a newline; without this flag, '.' will match anything except a newline. |
7
dddd 2015-02-01 09:38:50 +08:00
编译标识
re.M (MULTILINE) 多行匹配,影响 ^ 和 & |