[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#870319: ben: Please make generated simple query match the set of exact package names



On 01/08/2017 01:44, Balint Reczey wrote:
> The queries generated for the auto-* transitions may match more
> packages than expected due to \b matching "-".
> [...]
> -      let rex = Re_pcre.regexp (Printf.sprintf "\b(%s)\b" r_string) in
> +      let rex = Re_pcre.regexp (Printf.sprintf "[ ](%s)[, $]" r_string) in

Actually, I'm surprised it matches anything at all. Indeed, "\b" in a
string in OCaml is an escape sequence for backspace. So the generated
regexp looks for a backspace character. The removed line should be:

  let rex = Re_pcre.regexp (Printf.sprintf "\\b(%s)\\b" r_string) in

But it is true that this would (if r_string is set to "toto") match
"toto" in "toto-foo". Am I understanding right that this is not desired?

-- 
Stéphane


Reply to: