Talk:Python Programming/RegEx
Latest comment: 5 years ago by Dave Braunschweig in topic Meaning of '.'
Meaning of '.'
editUnder summary there is the statement:
In regex, . matches any single character.
My version of python3.6 on Mac excludes new line.
import re
string = """line1
line2
line3
"""
match = re.match(".*", string)
if match:
print("start:", match.start(0))
print("end:", match.end(0))
print("group:", match.group(0))
start: 0 end: 5 group: line1
ThaniosAkro (discuss • contribs) 09:33, 25 October 2019 (UTC)
- @ThaniosAkro: You are correct. "." matches every single character except newline, unless the DOTALL flag is used. [1] -- Dave Braunschweig (discuss • contribs) 13:08, 25 October 2019 (UTC)