[plt-dev] regexp equality

From: Neil Van Dyke (neil at neilvandyke.org)
Date: Fri Feb 19 13:39:39 EST 2010

Jay McCarthy wrote at 02/19/2010 01:20 PM:
> How do I test regexps for equality?
>   

Comparing the write format has limited usefulness:

(equal? (format "~S" #rx"aaa") (format "~S" #rx"aaa")) ==> #t
(equal? (format "~S" #rx"aaa") (format "~S" #rx"bbb")) ==> #f
(equal? (format "~S" #rx"[a]aa") (format "~S" #rx"aaa")) ==> #f

I don't know that comparing whatever compiled automata or abstract 
representations would be good enough to prove whether or not two regexps 
are equivalent.

-- 
http://www.neilvandyke.org/


Posted on the dev mailing list.