How to use wildcard in Python regular expression?

PythonServer Side ProgrammingProgramming

The following code uses the Python regex .()dot character for wildcard which stands for any character other than newline.

Example

import re
rex = re.compile('th.s')
l = "this, thus, just, then"
print rex.findall(l)

Output

This gives the output

['this', 'thus']
raja
Published on 11-Jan-2018 16:47:44
Advertisements