Related articles |
---|
compiling case insensitive regular expressions armelasselin@hotmail.com (Armel) (2010-11-01) |
Re: compiling case insensitive regular expressions gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-11-03) |
Re: compiling case insensitive regular expressions benhanson2@icqmail.com (2010-11-03) |
Re: compiling case insensitive regular expressions armelasselin@hotmail.com (Armel) (2010-11-04) |
Re: compiling case insensitive regular expressions rsc@swtch.com (Russ Cox) (2010-11-04) |
Re: compiling case insensitive regular expressions gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-11-05) |
Re: compiling case insensitive regular expressions cr88192@hotmail.com (BGB) (2010-11-06) |
From: | benhanson2@icqmail.com |
Newsgroups: | comp.compilers |
Date: | Wed, 03 Nov 2010 10:49:36 -0400 |
Organization: | Compilers Central |
References: | 10-11-004 |
Keywords: | lex |
Posted-Date: | 03 Nov 2010 23:45:23 EDT |
I found that it is more efficient to make the regex case insensitive
than to pre-process your input. If you use equivalence classes then
there is no increase in table size. The way to do it is to have a case
insensitive flag that you can turn on and off (see the flex syntax for
(?i: ) etc.) You donbt need to actually update the text of your regex,
you just test for the flag when you process each character set and add
in both characters then if necessary. So for example (?i:[abc])
resolves to [ABCabc].
HTH
Regards,
Ben Hanson (http://www.benhanson.net/lexertl.html)
Return to the
comp.compilers page.
Search the
comp.compilers archives again.