On Mon, Jul 23, 2007, James Hartley wrote:
>On 7/23/07, Shidan <[EMAIL PROTECTED]> wrote:
>> I'm looking for a Python module that provides methods for ordering
>> regexes based on
>> how general they are ( how much they match). Do I have to write it
>
>Your question is relative.  Classifying which regular expression is
>more general depends upon the other regular expressions used in
>comparison along with the specific input.  As you change input &
>regular expressions, the ordering will change.

As a first cut, one might sort the regular expression strings in
reverse order such that the longer strings are tested first.

Bill
--
INTERNET:   [EMAIL PROTECTED]  Bill Campbell; Celestial Software LLC
URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676

Virtually everything is under federal control nowadays except the
federal budget.
    -- Herman E. Talmadge, 1975
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to