Python regexp \n issue
Question: This searched ok:

    
    
    >>> re.search(r'(.*?)\r\n(.+?)\r\n', 'aaa\r\r\nbbb\r\n').groups()
    ('aaa\r', 'bbb')
    

But when I replace one of three `b` to `\n` it not searched:

    
    
    >>> re.search(r'(.*?)\r\n(.+?)\r\n', 'aaa\r\r\nb\nc\r\n').groups()
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: 'NoneType' object has no attribute 'groups'
    

But I want to parse in second case:

    
    
    ('aaa\r', 'b\nc')
    


Answer: You need the [DOTALL](https://docs.python.org/2/library/re.html#re.DOTALL)
flag:

    
    
    import re
    re.search(r'(.*?)\r\n(.+?)\r\n', 'aaa\r\r\nb\nc\r\n', flags=re.DOTALL).groups()
    

result:

    
    
    ('aaa\r', 'b\nc')
    

