Skip to content

search: treat * at pattern borders properly

Administrator requested to merge sh/kleene_star_prefix_and_suffix into master

Created by: stefanhengl

Currently, a * at the beginning or end of a pattern does not respect path separators, because we do not add regex anchors if a pattern begins or ends with *. With this PR the difference between* and ** becomes much more consistent: * is a universal matcher within the same path, ** matches everything.

glob before PR (translated regex) after PR (translated regex)
file:*.go matches any go file in the repo (file:[^/]*?\.go$ ) matches any go file in the root directory (file:^[^/]*?\.go$)
file:**.go matches any go file in the repo (file:.*?\.go$ ) matches any go file in the repo (file:^.*?\.go$)

Merge request reports

Loading