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
Post a Comment