DotNet.Glob icon indicating copy to clipboard operation
DotNet.Glob copied to clipboard

Composite character ranges

Open dazinator opened this issue 3 years ago • 0 comments

At the moment dotnet.glob supports either number or letter ranges in patterns, e.g

  • [A-Z]
  • [1-9]

However the Unix etc glob library supports a composite form of range expression:

[A-Fa-f0-9]

Ranges

   There is one special convention: two characters separated by '-'
   denote a range.  (Thus, "[A-Fa-f0-9]" is equivalent to
   "[ABCDEFabcdef0123456789]".)  One may include '-' in its literal
   meaning by making it the first or last character between the
   brackets.  (Thus, "[]-]" matches just the two characters ']' and
   '-', and "[--0]" matches the three characters '-', '.', '0',
   since '/' cannot be matched.)

Support for this could be implemented, and as far as I can see it wouldn't introduce any breaking behavioural changes as people don't have to use this pattern. I would perhaps implement new range tokens for this extended form

dazinator avatar Feb 26 '21 19:02 dazinator