mirror of
https://github.com/valitydev/yamerl.git
synced 2024-11-06 02:45:23 +00:00
Fix regexes: "\." becomes "\\."
This commit is contained in:
parent
7930aa8759
commit
5da1810828
@ -93,7 +93,7 @@ string_to_float(Text) ->
|
||||
|
||||
string_to_float2(Text) ->
|
||||
Opts = [{capture, none}],
|
||||
Ret = re:run(Text, "^(\.[0-9]+|[0-9]+(\.[0-9]*)?)([eE][-+]?[0-9]+)?$",
|
||||
Ret = re:run(Text, "^(\\.[0-9]+|[0-9]+(\\.[0-9]*)?)([eE][-+]?[0-9]+)?$",
|
||||
Opts),
|
||||
case Ret of
|
||||
match -> erlang_list_to_float(Text);
|
||||
|
@ -83,7 +83,8 @@ string_to_float(Text) ->
|
||||
|
||||
string_to_float2(Text) ->
|
||||
Opts = [{capture, none}],
|
||||
case re:run(Text, "^(0|[1-9][0-9]*)(\.[0-9]*)?([eE][-+]?[0-9]+)?$", Opts) of
|
||||
Ret = re:run(Text, "^(0|[1-9][0-9]*)(\\.[0-9]*)?([eE][-+]?[0-9]+)?$", Opts),
|
||||
case Ret of
|
||||
match -> yamerl_node_float:erlang_list_to_float(Text);
|
||||
nomatch -> error
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user