Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python regex match until first occurrence

import re

#first match of 1 or more numbers combined
first_match = re.findall(r'[0-9]+', '321hello123')[0]

print(f'The first match is {first_match}')
 
PREVIOUS NEXT
Tagged: #python #regex #match #occurrence
ADD COMMENT
Topic
Name
7+6 =