On Sep 9, 12:42 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote:
>
> you may also want to do re.escape on all the words, to avoid surprises
> when the choices contain special characters.
yes, thank you very much:
import re
def oneOf(s):
alts = sorted(s.split(), reverse=True)
alts = [re.esca
On Sep 9, 9:23 am, [EMAIL PROTECTED] wrote:
> >> I really dont care if theexpressionis optimal. So the goal is
> >> something like:
>
> >> vowel_regexp = oneOf("a aa i ii u uu".split()) # yielding r'(aa|a|uu|
> >> u|ii|i)'
>
> >> Is there a public module available for this purp
Larry Bates wrote:
vowel_regexp = oneOf("a aa i ii u uu".split()) # yielding r'(aa|a|uu|
u|ii|i)'
Is there a public module available for this purpose?
Perhaps I'm missing something but your function call oneOf(...) is
longer than than actually specifying the result.
You can certainly writ
On Sep 9, 9:12 am, "metaperl.com" <[EMAIL PROTECTED]> wrote:
> Pyparsing has a really nice feature that I want in PLY. I want to
> specify a list of strings and have them converted to a regular
> expression.
>
> A Perl module which does an aggressively optimizing job of this is
> Regexp::List
> -
metaperl.com <[EMAIL PROTECTED]> wrote:
> Pyparsing has a really nice feature that I want in PLY. I want to
> specify a list of strings and have them converted to a regular
> expression.
>
> A Perl module which does an aggressively optimizing job of this is
> Regexp::List -
> http://search.c
On Tue, 09 Sep 2008 08:19:04 -0500, Larry Bates wrote:
>> I really dont care if the expression is optimal. So the goal is
>> something like:
>>
>> vowel_regexp = oneOf("a aa i ii u uu".split()) # yielding r'(aa|a|uu|
>> u|ii|i)'
>>
>> Is there a public module available for this purpose?
>>
>>
>> I really dont care if the expression is optimal. So the goal is
>> something like:
>> vowel_regexp = oneOf("a aa i ii u uu".split()) # yielding r'(aa|a|uu|
>> u|ii|i)'
>> Is there a public module available for this purpose?
Check Ka-Ping Yee's rxb module:
http://lfw
metaperl.com wrote:
Pyparsing has a really nice feature that I want in PLY. I want to
specify a list of strings and have them converted to a regular
expression.
A Perl module which does an aggressively optimizing job of this is
Regexp::List -
http://search.cpan.org/~dankogai/Regexp-Optimizer-0.1
Pyparsing has a really nice feature that I want in PLY. I want to
specify a list of strings and have them converted to a regular
expression.
A Perl module which does an aggressively optimizing job of this is
Regexp::List -
http://search.cpan.org/~dankogai/Regexp-Optimizer-0.15/lib/Regexp/List.pm