Created
September 13, 2016 22:12
-
-
Save hackjutsu/b0b96b658b875ffcd026da120e427472 to your computer and use it in GitHub Desktop.
Demo for using regex in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
testStr = "//gss0.baidu.com/6b1IcTe9R1gBo1vgoIiO_jowehsv/maps/services/thumbnails?width=525&height=295&quality=100&align=middle,middle&src=http://gss0.baidu.com/7LsWdDW5_xN3otqbppnN2DJv/lvpics/pic/item/8cb1cb134954092315ec8fd29258d109b2de4991.jpg" | |
pattern = "http.*jpg" | |
m = re.search(pattern, testStr) | |
print(m.group(0)) | |
# http://gss0.baidu.com/7LsWdDW5_xN3otqbppnN2DJv/lvpics/pic/item/8cb1cb134954092315ec8fd29258d109b2de4991.jpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment