I know there is plenty of info about regex available but I can’t figure it out somehow.
I have an array1 = ['\n 1.979 \n, \n 1.799 \n']
which looks like this but the numbers vary but are always in this format so the regex = re.compile(r'\d.\d\d\d')
which matches perfectly in notepad++ but doesn’t seems to work in python.
import re
regex = re.compile(r'\d.\d\d\d')
filteredarray= [i for i in array1 if regex.match(i)]
print(filteredarray)
what am I missing? Thanks in Advance