I want to match a floating number that might be in the form of 0.1234567 or 1.23e-5 Here is my python code:
import re
def main():
m2 = re.findall(r'\d{1,4}:[-+]?\d+\.\d+(e-\d+)?', '1:0.00003 3:0.123456 8:-0.12345')
for svs_elem in m2:
print svs_elem
main()
It prints blank... Based on my test, the problem was in (e-\d+)? part. Thank you!
Aucun commentaire:
Enregistrer un commentaire