diff --git a/lib/ronin/support/text/patterns/numeric.rb b/lib/ronin/support/text/patterns/numeric.rb index e792f31b..8d939c19 100644 --- a/lib/ronin/support/text/patterns/numeric.rb +++ b/lib/ronin/support/text/patterns/numeric.rb @@ -30,7 +30,7 @@ module Patterns # Regular expression for finding all numbers in text. # # @since 1.0.0 - NUMBER = /(?:-)?[0-9]+/ + NUMBER = /(?:-)?[0-9]+(?:e[+-]?\d+)?/ # Regular expression for finding all floating point numbers in text. # diff --git a/spec/text/patterns/numeric_spec.rb b/spec/text/patterns/numeric_spec.rb index 3fe07171..924c65f0 100644 --- a/spec/text/patterns/numeric_spec.rb +++ b/spec/text/patterns/numeric_spec.rb @@ -15,6 +15,18 @@ it "must match negative numbers" do expect("-#{number}").to fully_match(subject) end + + it "must match numbers with an 'e' exponent suffix" do + expect("1e10").to fully_match(subject) + end + + it "must match numbers with an 'e+' exponent suffix" do + expect("1e+10").to fully_match(subject) + end + + it "must match numbers with an 'e-' exponent suffix" do + expect("1e-10").to fully_match(subject) + end end describe "FLOAT" do