Regular expression grouping:? Role

Action: a regular expression packet? :? Represents the current packet does not capture the look example: <html> xxx </ html > through a packet can be abbreviated as:  R & lt "<([A-zA-Z1-6] +)> . * </ \ 1> " However, if write r" <(:? [a -zA-Z1-6] +)> * </ \ 1> ", \ 1 can not get to the front of the packet appears. reference group invalid error. error: invalid group reference 1 at position 23 in re.findall, the matching valid mailbox Y = '@ 123 [email protected] @ @ adfcom 126.comasdfasfs33333' <ignore_js_op> These results because if there findll packet, only the data packets match. In the group in plus:? Not capture the current group. <ignore_js_op>







 

 

More technical information may concern: gzitcast

Guess you like

Origin www.cnblogs.com/heimaguangzhou/p/11590642.html