在import re中pattern中的括号'()'对执行结果产生了什么影响?

#案例一
import re
string = "abcdefg acbdgef abcdgfe cadbgfe"
regex = re.compile("((\w+)\s+\w+)")
regex1 = re.compile("(\w+)\s+\w+")
regex2 = re.compile("\w+\s+\w+")
print(regex.findall(string))
print(regex1.findall(string))
print(regex2.findall(string))


#案例二
import re
pattern = r'([1-9]{1,3}(\.[0-9]{1,3}){3})'
str1 = '127.0.0.1 192.168.1.66'
match = re.findall(pattern,str1)
for item in match:
    print(item[0])


#案例三
import re
pattern = r'[1-9]{1,3}(\.[0-9]{1,3}){3}'
str1 = '127.0.0.1 192.168.1.66'
match = re.findall(pattern,str1)
print(match)

想要了解“()”的在该项案例中的原理以及如何理想执行结果的。 

这里'()'是配合r一块使用的,即 r'()' 意思就是 防止()内字符转义的。
如:出现'\t'的话 不加r的话\t就会被转义 而加了'r'之后'\t'就能保留原有的样子

那你参考下这个:https://blog.csdn.net/zd147896325/article/details/79010621https://www.cnblogs.com/one-lightyear/p/6814833.html