I wrote the following code in Python to match string inside files:
#!/usr/bin/python
import re
f = open('file','r')
for line in f:
mat = re.search(r'This',line)
mat.group(0)
f.close()
I used the following file as input:
This is the first line
That was the first line
But when I try to search for the expression This
it results in None
output.
Why isn't the string is not matching?