Re: emulating an and operator in regular expressions

2005-01-03 Thread Andrew Dalke
Craig Ringer wrote: > My first thought would be to express your 'A and B' regex as: > > (A.*B)|(B.*A) > > with whatever padding, etc, is necessary. You can even substitute in the > sub-regex for A and B to avoid writing them out twice. That won't work because of overlaps. Consider barkeep w

Re: emulating an and operator in regular expressions

2005-01-03 Thread John Machin
Terry Reedy wrote: > "Craig Ringer" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > On Mon, 2005-01-03 at 08:52, Ross La Haye wrote: > >> How can an and operator be emulated in regular expressions in Python? > > Regular expressions are designed to define and detect repetition and

Re: emulating an and operator in regular expressions

2005-01-03 Thread Terry Reedy
"Craig Ringer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 2005-01-03 at 08:52, Ross La Haye wrote: >> How can an and operator be emulated in regular expressions in Python? Regular expressions are designed to define and detect repetition and alternatives. These are ea

Re: emulating an and operator in regular expressions

2005-01-03 Thread Craig Ringer
On Mon, 2005-01-03 at 08:52, Ross La Haye wrote: > How can an and operator be emulated in regular expressions in Python? > Specifically, I want to return a match on a string if and only if 2 or more > substrings all appear in the string. For example, for a string s = 'Jones > John' and substrings