lib/sportdb/utils_round.rb in sportdb-1.8.20 vs lib/sportdb/utils_round.rb in sportdb-1.8.21

- old
+ new

@@ -120,11 +120,23 @@ # extract optional round pos from line # e.g. (1) - must start line regex_pos = /^[ \t]*\((\d{1,3})\)[ \t]+/ + + #### fix: + ## use/make keywords required + # e.g. Round of 16 -> should NOT match 16! + # Round 16 - ok + # thus, check for required keywords + ## find free standing number - regex_num = /\b(\d{1,3})\b/ + # note: /\b(\d{1,3})\b/ + # will match -12 + # thus, use space required - will NOT match -2 e.g. Group-2 Play-off + # note: allow 1. Runde n + # 1^ Giornata + regex_num = /(?:^|\s)(\d{1,3})(?:[.\^\s]|$)/ if line =~ regex_pos logger.debug " pos: >#{$1}<" line.sub!( regex_pos, '[ROUND.POS] ' ) ## NB: add back trailing space that got swallowed w/ regex -> [ \t]+ \ No newline at end of file