# 關於科學記數法的數字的正則表達式？

vn 8.67548e-017 1 -1.55211e-016

## 最佳答案

-?[\d.]+(?:e-?\d+)?


-?      # an optional -
[\d.]+  # a series of digits or dots (see *1)
(?:     # start non capturing group
e     # "e"
-?    # an optional -
\d+   # digits
)?      # end non-capturing group, make optional


**1) This is not 100% correct, technically there can be only one dot, and before it only one (or no) digit. But practically, this should not happen. So 正則表達式是 a good approximation and false positives should be very unlikely. Feel free to make the regex more specific.*