Skip to main content
Regexflux

Scientific Notation

intermediate

Matches numbers in scientific notation like 1.23e-4 or 6.022E23.

numberscientificexponentialparsing

Pattern

/-?\d+(?:\.\d+)?[eE][+-]?\d+/g

Try It

0 of 8 strings matched

Explanation

Matches a number (integer or decimal) followed by 'e' or 'E' and an exponent (optional sign with digits).

Test Strings

Matching

  • 1.23e-4
  • 6.022E23
  • -1e10
  • 5.0e+3

Non-matching

  • 1.23
  • e10
  • 1.23e
  • abc

Language Compatibility

LanguageSupport
JSFull support
PYTHONFull support
JAVAFull support
PHPFull support
GOFull support

Code Snippets

const regex = /-?\d+(?:\.\d+)?[eE][+-]?\d+/g;
const text = "your text here";
const matches = text.match(regex);
console.log(matches);

Related Patterns