Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Glob: Double asterisk match including slash #172

Merged
merged 5 commits into from
Apr 7, 2020

Conversation

Julow
Copy link
Contributor

@Julow Julow commented Apr 1, 2020

Hi,

This PR adds support for double asterisks (**) to Glob.
It is like * but also matches / characters, even when pathname is set.

For example, foo/** will match both foo/bar and foo/bar/baz.

The period flag still work, foo/** won't match foo/.bar but foo/.** will.

Related to issue #171
This is useful in OCamlformat, where the matching is done on the whole path: ocaml-ppx/ocamlformat#1234

The double asterisk ('**') matches slash characters when `pathname` is
true.
We must match each components and leading periods individually.
@rgrinberg
Copy link
Member

Seems good. Could you add a CHANGES entry?

@Julow
Copy link
Contributor Author

Julow commented Apr 7, 2020

Added.

@rgrinberg rgrinberg merged commit aa77ded into ocaml:master Apr 7, 2020
rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Aug 25, 2021
CHANGES:

* Add the `[:alpha:]` character class in `Re.Perl` (ocaml/ocaml-re#169)
* Double asterisk (`**`) in `Re.Glob` (ocaml/ocaml-re#172)
  Like `*` but also match `/` characters when `pathname` is set.
* Double asterisk should match 0 or more directories unless in trailing
  position. (ocaml/ocaml-re#192, fixes ocaml/ocaml-re#185)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants