โค้ดต่อไปนี้ใช้ Python regex เพื่อจับคู่ตัวเลขทศนิยม ตัวอย่าง import re s = '234.6789' match = re.match(r'[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?',s) print match.group() s2 = '0.45' match = re.match(r'[+-]?(\d+(\.\d*)?|\.\d+)([eE][+-]?\d+)?',s2) print match.group() ผล