I'm trying to match the following text with a regex in Python 2.7
SUBCASE 8
SUBCASE 9
SUBCASE 10
SUBCASE 11
The number of spaces between "subcase" and the number drops from 3 to 2. I'm trying to use this regex in Python:
(SUBCASE)[\\s+]([0-9]+)
Where am I going wrong? Shouldn't the \\s+
mean "catch any white spaces more than one"?
You'll want:
SUBCASE\s+([0-9]+)
or
SUBCASE\s+(\d+)
Putting \\s+
inside of [...]
means, that you want precisely one symbol that either is a whitespace character, or a plus.
(SUBCASE)\s+([0-9]+)
你使用了[\\ s +]来做一个空格或+符号的字符匹配
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.