こんな感じで書く
import re
pattern = re.compile(r'world') #<-regex
match = pattern.search('Hello world!')
if match:
print 'match string is', match.group()
else:
print 'match string not found'
#->match string is world
More than 5 years have passed since last update.
こんな感じで書く
import re
pattern = re.compile(r'world') #<-regex
match = pattern.search('Hello world!')
if match:
print 'match string is', match.group()
else:
print 'match string not found'
#->match string is world
Register as a new user and use Qiita more conveniently