javascript - What is the meaning of '|e' in RegExp -
in line below, purpose of '|e'? tried looking couldn't find it, , line still it's supposed when isn't there.
pattern = /([\+|\-]?[\d]+[\.][\d|\-|e]+)[ ]+([\+|\-]?[\d]+[\.][\d|\-|e]+)[ ]+([\+|\-]?[\d]+[\.][\d|\-|e]+)/g;
edit:
here sample of code parsing.
-3.424999 -0.855454 2.257396 -1.484919 0.665606 -3.151304 1.636841 -0.848154 -0.458954 3.732041 0.187906 -1.319734 -1.756719 0.682006 0.807596 0.911641 -0.828054 3.040696 -0.218059 -0.489374 -3.806524 -1.078099 0.891706 -2.420454
normally, |
gives alternative options, (one|two)
matches either 1 or two.
however putting |
inside []
suggests doesn't understand how []
work (they match single instance of character within them - or range, [a-z]
matches or b or c...
i suspect, unless have |
within string matching, can remove of |
occurences pattern , still work. it's difficult know more without seeing examples of kind of string should matching, , want capture.
(edit): have provided sample, if parsing that, use like
/([+-]?\d+\.\d+)\s([+-]?\d+\.\d+)\s([+-]?\d+\.\d+)/
if want able accept numbers of form 1.234e56 change
/([+-]?\d+\.\d+(e[+-]?\d+)?)\s([+-]?\d+\.\d+(e[+-]?\d+)?)\s([+-]?\d+\.\d+(e[+-]?\d+)?)/
(the above assumes there decimal point)
Comments
Post a Comment