Suddenly I realized a little bit of skill, first written here, lest later forget again.
There is a string s= ' style= ' border-top:1px dotted #DDD; text-align:left;padding-left:5px; " ><a href= "' +e.url+ '" target= "_blank" I want to take ddd out of regular expressions
You can use this string with the # and before and after the DDD, as delimiters. Examples are as follows
Import re
s= "style=" border-top:1px dotted #DDD; text-align:left;padding-left:5px; " ><a href= "' +e.url+ '" target= "_blank"
Reg=r ' [#;] + ' #关键是规则
Li=re.split (Reg,s)
Print (LI)
The results of the operation are as follows:
[' style= ' border-top:1px dotted ', ' DDD ', ' text-align:left ', ' padding-left:5px ', ' ><a href= ' \ ' +e.url+\ ' "target=" _blank ']
Summary: to take out which string to look at the string before and after it is wrapped by which two characters, use these two characters as separators to separate the string
Python shell regular expression captures complex string-specific substrings