Python/Regex

From Fundamental Ramen
< Python
Revision as of 07:26, 31 May 2018 by Tacoball (talk | contribs) (Created page with "= To Match = <source lang="python"> if re.search(pattern, subject): pass m = re.match(pattern, subject) if m: pass </source> = To Replace = <source lang="python"> ns...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

To Match

if re.search(pattern, subject):
    pass

m = re.match(pattern, subject)
if m:
    pass

To Replace

ns = re.sub('o+', '_', 'doooooog')