Get the common prefix substring through Regex
- by Dreampuf
like this
text = " \t hello there\n \t how are you?\n \t HHHH"
hello there
how are you?
HHHH
Could I get the common prefix substring through regex?
I try to
In [36]: re.findall(r"(?m)(?:(^[ \t]+).+[\n\r]+\1)", " \t hello there\n \t how are you?\n \t HHHH")
Out[36]: [' \t ']
But apparently that common prefix substring is ' \t '
I want use for dedent function like python textwrap module.