RE Engine error with sub()

Maurice LING mauriceling at acm.org
Sat Apr 16 21:04:38 EDT 2005


Solved it. Instead of modifying Replacer class, I've made another class 
which initiates a list of Replacer objects from a list of substitution 
rule files. And then iterates through the list of Replacer objects and 
calls upon their own substitute() method. It seems to work.

Thanks for all your advices.

Cheers
Maurice


Maurice LING wrote:

> Hi all,
> 
> I think I might have a workaround to this problem but have no idea how 
> to work it through. I hope that someone can kindly help me out because I 
> do not quite understand the mechanics of the _make_regex() method in the 
> original codes...
> 
> My idea is, instead of having one UserDict, have a list of UserDicts. So 
>  a large unprocessable replacement rule set is split into multiple 
> smaller files, with each file read into a UserDict and it is made into a 
>  RE matcher. Then iterative matching using a list of REs.
> 
> In short, the current precedure is
> 1 dictionary, 1 RE, 1 RE matcher... to match inputs
> My workaround is to change it to
> list of dictionaries, list of REs, list of RE matcher... iterative 
> matching of inputs.
> 
> Can someone kindly help me out here?
> 
> Thanks in advance.
> 
> Cheers,
> Maurice
> 




More information about the Python-list mailing list