Skip to content

Latest commit

 

History

History
19 lines (17 loc) · 312 Bytes

python_regex.md

File metadata and controls

19 lines (17 loc) · 312 Bytes

playground

https://regex101.com/

findall

import re

txt = "The rain in Spain"
x = re.findall("^The.*Spain$", txt) 
  ['The rain in Spain']

compiled regex

import re

txt = "adfafad (Mssnnd) (ABC) (DEF)"
comp_reg = re.compile("\(([A-Z]+)\)$")
x = comp_reg.findall(txt) 
  ['DEF']