全部博文(2065)
分类: Python/Ruby
2009-03-06 13:57:52
\d
匹配任何十进制数;它相当于类 [0-9]。
\D匹配任何非数字字符;它相当于类 [^0-9]。
\s
匹配任何空白字符;它相当于类 [ \t\n\r\f\v]。
\S
匹配任何非空白字符;它相当于类 [^ \t\n\r\f\v]。
\w
Matches any alphanumeric character; this is equivalent to the class [a-zA-Z0-9_].
匹配任何字母数字字符;它相当于类 [a-zA-Z0-9_]。
\W
Matches any non-alphanumeric character; this is equivalent to the class [^a-zA-Z0-9_].match() |
Determine if the RE matches at the beginning of the string. |
search() |
Scan through a string, looking for any location where this RE matches. |
findall() |
Find all substrings where the RE matches, and returns them as a list. |
finditer() |
Find all substrings where the RE matches, and returns them as an iterator. |
group() |
Return the string matched by the RE |
start() |
Return the starting position of the match |
end() |
Return the ending position of the match |
span() |
Return a tuple containing the (start, end) positions of the match |