Filter returns a reduced [Pattern] that is subset equal to [filter]. Returns false if there's no overlap between [filter] and [other]. Examples: - Filter(MustParsePattern("bar/**"), MustParsePattern("**")) => returns "bar/**" - Filter(MustParsePattern("**"), MustParsePattern("**")) => returns "**" -
(filter, other Pattern)
| 161 | // - Filter(MustParsePattern("bar/**"), MustParsePattern("bar")) => returns "bar" |
| 162 | // - Filter(MustParsePattern("bar/**"), MustParsePattern("foo/**")) => returns false |
| 163 | func Filter(filter, other Pattern) (Pattern, bool) { |
| 164 | if filter.Includes(other) { |
| 165 | return other, true |
| 166 | } |
| 167 | if other.Includes(filter) { |
| 168 | return filter, true |
| 169 | } |
| 170 | return nil, false |
| 171 | } |
| 172 | |
| 173 | func replace1(original, other string) (string, error) { |
| 174 | components := split(original) |