Fix Bug in quey 'is_a_valid_number'

Remove the space after :  in the regular expression "-?(?: 0|[1-9]\d*)(?: \.\d+)?(?: [eE][+-]?\d+)?\b"
This commit is contained in:
jvelilla
2008-08-08 11:17:32 +00:00
parent b674dbddf7
commit c59bc37a40

View File

@@ -341,13 +341,14 @@ feature {NONE} -- Implementation
do do
create regexp.make create regexp.make
create word_set.make_empty create word_set.make_empty
a_number.right_adjust
a_number.left_adjust
word_set.add_string ("0123456789.eE+-") word_set.add_string ("0123456789.eE+-")
regexp.set_word_set (word_set) regexp.set_word_set (word_set)
number_regex := "-?(?: 0|[1-9]\d*)(?: \.\d+)?(?: [eE][+-]?\d+)?\b" number_regex := "-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?\b"
regexp.compile (number_regex) regexp.compile (number_regex)
if regexp.matches (a_number) then if regexp.matches (a_number) then
a_number.right_adjust if a_number.is_equal (regexp.captured_substring (0)) then
if a_number.is_equal (regexp.captured_substring (0)) then
Result := true Result := true
end end
end end