-2

When applying regex to a multiline string, I realize the regex may be correct according to rubular.com. The problem is that somehow it is not working against multiline text. Question is, I attempted to do "item.strip()" and no change in behavior.

s = """ #if route rate 230.207.200.1', '', '   
(50.50.50.11,230.207.200.1)', """
for item in s: 
    match = re.findall(r'([0-9].[0-9].[0-9].[0-9],.........)', s) 
if match:
    print('match')
Josep Valls
  • 5,102
  • 2
  • 30
  • 59
Mr Bright
  • 27
  • 3

1 Answers1

0

Do you have any line ending matching or dot character in there? Try setting the flags to either re.DOTALL or re.MULTILINE, for example:

re.findall(r'...', s, flags=re.DOTALL)

Josep Valls
  • 5,102
  • 2
  • 30
  • 59