File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ class InputType:
21
21
DOT = 4
22
22
EXPONENT = 5
23
23
24
- # regular expression: "^\s*[\+\ -]?((\d+(\.\d*)?)|\.\d+)([eE][+-]?\d+)?\s*$"
24
+ # regular expression: "^\s*[+ -]?((\d+(\.\d*)?)|\.\d+)([eE][+-]?\d+)?\s*$"
25
25
# automata: http://images.cnitblog.com/i/627993/201405/012016243309923.png
26
26
class Solution :
27
27
# @param s, a string
@@ -63,11 +63,11 @@ class Solution2:
63
63
# @return a boolean
64
64
def isNumber (self , s ):
65
65
import re
66
- return bool (re .match ("^\s*[\+\ -]?((\d+(\.\d*)?)|\.\d+)([eE][+-]?\d+)?\s*$" , s ))
66
+ return bool (re .match ("^\s*[+ -]?((\d+(\.\d*)?)|\.\d+)([eE][+-]?\d+)?\s*$" , s ))
67
67
68
68
if __name__ == "__main__" :
69
69
print Solution ().isNumber (" 0.1 " )
70
70
print Solution ().isNumber ("abc" )
71
71
print Solution ().isNumber ("1 a" )
72
72
print Solution ().isNumber ("2e10" )
73
-
73
+
You can’t perform that action at this time.
0 commit comments