Python regex equivalent for perl -


what equivalent of following perl condition in python

if($line=~/drambase/) 

i tried following didn't match(the line @ bottom)

if(re.match( r'drambase', line)): 

i had change

if(re.match( r'.*drambase', line)): 

to match line

# -df0.ccm0.drambaseaddress1 0x00004001 

is there flag match anywhere on line without explicitly matching starting characters ?

you need use re.search, not re.match. re.match matches beginning of string, while re.search matches anywhere, in perl.


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -