Skip to content

Commit

Permalink
Merge pull request #30 from mattn/negation
Browse files Browse the repository at this point in the history
Support negation
  • Loading branch information
mattn authored Aug 13, 2021
2 parents 70beb52 + 98660ab commit 254b632
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions zglob.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,26 @@ func New(pattern string) (*zenv, error) {
filemask += "(" + pattern + ")"
continue
}
} else if i < len(cc)-1 && cc[i] == '!' && cc[i+1] == '(' {
i++
pattern := ""
for j := i + 1; j < len(cc); j++ {
if cc[j] == ')' {
i = j
break
} else {
c := cc[j]
pattern += fmt.Sprintf("[^\\x%02X/]*", c)
}
}
if pattern != "" {
if dirmask == "" {
dirmask = filemask
root = filemask
}
filemask += pattern
continue
}
}
c := cc[i]
if c == '/' || ('0' <= c && c <= '9') || ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || 255 < c {
Expand Down

0 comments on commit 254b632

Please sign in to comment.