Regular value

Coding. 8 = UTF-# 
Import Re
from The urllib.parse Import parse_qsl
'' '
formula:
to know before and after taking the middle, an escape character is encountered \;
take a complement to the rear end of $

' ''
# regular expressions Value
# the first: taking the middle value, with, take the middle longitudinal known, an escape character is encountered \ (+.?)
a = '= value "abcbdbxbxbbb"'
R & lt = the re.findall ( '= value "(. +)? " ', a)
Print (R & lt [0])
results of printing: abcbdbxbxbbb

# second, to take up the rear end of a $, take Hello = B
a =" https://xxx.com/? a = the HelloWorld & b = the Hello "
r = re.findall ( 'LD \ & (+) $.?', a)
Print (r [0])
printed results: b = the Hello

# I want to take a = the HelloWorld
a = Re .findall ( 'COM /\?(.+?)\&', a)
Print (a [0])
results of printing: a = helloworld
Coding. 8 = UTF-# 
Import Re
from The urllib.parse Import parse_qsl
'' '
formula:
to know before and after taking the middle, an escape character is encountered \;
take a complement to the rear end of $

' ''
# regular expressions Value
# the first: taking the middle value, with, take the middle longitudinal known, an escape character is encountered \ (+.?)
a = '= value "abcbdbxbxbbb"'
R & lt = the re.findall ( '= value "(. +)? " ', a)
Print (R & lt [0])
results of printing: abcbdbxbxbbb

# second, to take up the rear end of a $, take Hello = B
a =" https://xxx.com/? a = the HelloWorld & b = the Hello "
r = re.findall ( 'LD \ & (+) $.?', a)
Print (r [0])
printed results: b = the Hello

# I want to take a = the HelloWorld
a = Re .findall ( 'COM /\?(.+?)\&', a)
Print (a [0])
results of printing: a = helloworld

Guess you like

Origin www.cnblogs.com/YangQingHong/p/11005733.html