Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python regex search file

import re
pattern = re.compile("<(d{4,5})>")

for i, line in enumerate(open('test.txt')):
    for match in re.finditer(pattern, line):
        print('Found on line %s: %s' % (i+1, match.group()))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #regex #search #file
ADD COMMENT
Topic
Name
1+2 =