I have the following python code that will try to read an input file and find the following instances of the give regular expression:
[fF][eE][bB]([1-2][0-9]|[0-9]
I have written the following python code
#!/usr/bin/python
import re
import sys
textFile = open(sys.argv[1], 'r')
fileText = textFile.read()
textFile.close()
matches = re.findall("[fF][eE][bB] ([1-2][0-9]|[0-9])",fileText)
print matches
and my input file is :
1 2 3 the
the quick 2354
feb 1
feb 0
feb -10
feb23
feb 29
feb 3
february 10
However when I run my code I get following output: ['1','29', '3']
I want my output to be more like ['feb 1', 'feb 29', 'feb 3']
I am not really sure what I'm doing wrong. Any help would be greatly appreciated.