@@ -110,11 +110,14 @@ ruleDecimalWithThousandsSeparator :: Rule
110
110
ruleDecimalWithThousandsSeparator = Rule
111
111
{ name = " decimal with thousands separator"
112
112
, pattern =
113
- [ regex " (\\ d+(, \\ d\\ d\\ d)+\\ . \\ d+)"
113
+ [ regex " (\\ d+(\\ . \\ d\\ d\\ d)+, \\ d+)"
114
114
]
115
115
, prod = \ tokens -> case tokens of
116
116
(Token RegexMatch (GroupMatch (match: _)): _) ->
117
- parseDouble (Text. replace (Text. singleton ' ,' ) Text. empty match) >>= double
117
+ let dot = Text. singleton ' .'
118
+ comma = Text. singleton ' ,'
119
+ fmt = Text. replace comma dot $ Text. replace dot Text. empty match
120
+ in parseDouble fmt >>= double
118
121
_ -> Nothing
119
122
}
120
123
@@ -138,11 +141,11 @@ ruleDecimalNumeral :: Rule
138
141
ruleDecimalNumeral = Rule
139
142
{ name = " decimal number"
140
143
, pattern =
141
- [ regex " (\\ d*\\ . \\ d+)"
144
+ [ regex " (\\ d*, \\ d+)"
142
145
]
143
146
, prod = \ tokens -> case tokens of
144
147
(Token RegexMatch (GroupMatch (match: _)): _) ->
145
- parseDecimal True match
148
+ parseDecimal False match
146
149
_ -> Nothing
147
150
}
148
151
@@ -689,13 +692,13 @@ ruleNumeralDotNumeral = Rule
689
692
690
693
ruleIntegerWithThousandsSeparator :: Rule
691
694
ruleIntegerWithThousandsSeparator = Rule
692
- { name = " integer with thousands separator , "
695
+ { name = " integer with thousands separator . "
693
696
, pattern =
694
- [ regex " (\\ d{1,3}(, \\ d\\ d\\ d){1,5})"
697
+ [ regex " (\\ d{1,3}(\\ . \\ d\\ d\\ d){1,5})"
695
698
]
696
699
, prod = \ tokens -> case tokens of
697
700
(Token RegexMatch (GroupMatch (match: _)): _) ->
698
- parseDouble (Text. replace (Text. singleton ' , ' ) Text. empty match) >>= double
701
+ parseDouble (Text. replace (Text. singleton ' . ' ) Text. empty match) >>= double
699
702
_ -> Nothing
700
703
}
701
704
0 commit comments