Re: Matching subpatterns in any order, conjunctions, negated matches

2020-05-17 Thread Joseph Brenner
Peter Pentchev wrote: > Actually, there is, and I conveniently did not mention it :) It's the > case when the patterns may overlap: if you do the ' 'the' and 'entrance', you might match 'thentrance', which, depending on > your use case, might not be ideal. That's a good point, but it's true that

Re: Matching subpatterns in any order, conjunctions, negated matches

2020-05-16 Thread Peter Pentchev
On Sat, May 16, 2020 at 05:53:04PM -0700, Joseph Brenner wrote: > Peter Pentchev wrote: > > On Fri, May 15, 2020 at 07:32:50PM -0700, Joseph Brenner wrote: > >> Regex engines by their nature care a lot about order, but I > >> occasionally want to relax that to match for multiple > >>

Re: Matching subpatterns in any order, conjunctions, negated matches

2020-05-16 Thread Joseph Brenner
Yes, both of those work, and arguably they're a little cleaner looking than my conjunction approach-- though it's not necessarily any easier to think about. It looks like a pattern that's matching for three things in order, but the zero-widthness of the "before" let's them all work on top of each

Re: Matching subpatterns in any order, conjunctions, negated matches

2020-05-16 Thread Joseph Brenner
This is pretty interesting, though I think you're talking about a different subject... I was talking about cases where the sub-patterns are more than one character long. It's true that if you were interested in single-character sub-patterns, then you could get close with character classes and

Re: Matching subpatterns in any order, conjunctions, negated matches

2020-05-16 Thread William Michels via perl6-users
On Fri, May 15, 2020 at 7:33 PM Joseph Brenner wrote: > > Regex engines by their nature care a lot about order, but I > occasionally want to relax that to match for multiple > multicharacter subpatterns where the order of them doesn't > matter. > > Frequently the simplest thing to do is just to

Re: Matching subpatterns in any order, conjunctions, negated matches

2020-05-16 Thread Peter Pentchev
On Fri, May 15, 2020 at 07:32:50PM -0700, Joseph Brenner wrote: > Regex engines by their nature care a lot about order, but I > occasionally want to relax that to match for multiple > multicharacter subpatterns where the order of them doesn't > matter. > > Frequently the simplest thing to do is

Matching subpatterns in any order, conjunctions, negated matches

2020-05-15 Thread Joseph Brenner
Regex engines by their nature care a lot about order, but I occasionally want to relax that to match for multiple multicharacter subpatterns where the order of them doesn't matter. Frequently the simplest thing to do is just to just do multiple matches. Let's say you're looking for words that