Regexp.compile in perl 
Author Message
 Regexp.compile in perl

A lot of people seem to be complaining that perl does not have
regular expresson compiling seperate from reqular expression
evaluating.  For some specialized applications those two would
be very nice to have seperate, but 90% of the time perl's method
works and is much easier to explain.

It occured to me that with perl 5 Larry gave us the ability to add
any feature we feel is missing without cluttering the language.
What if someone wrote a perl 5 extension that provided another
interface to perl's own regular expression package?  I assume it
has regcomp and regexec...

Something like:

require Regex;

$r = new Regex q{(?x)
                long expression};

$foo = "long string";

if ($r->match($foo)) {
        do something;


undef $r;       # free memory of compiled Regex

(or the about with normal function calls.)

We could do arrays of precompiled expressions, recompile expression only when needed,
not use eval...

Anyone know how to call perl's REs?

--------                                                                |
Wayne Scott                     P6 Architecture Performance

Sat, 03 May 1997 00:41:48 GMT  
 [ 1 post ] 

 Relevant Pages 

1. negated compiled regexp

2. compiling module compiles PERL?!?

3. compiling module compiles PERL?!?

4. Compiling perl 5.002 on BSDI 2.1 - compile errors

5. Optimize regexp for word list (trie regexp)

6. regexp of regexp ?

7. RegExp Error Under UNIX PERL Runs Under Win32 PERL

8. Compiling code at run-time, not compile-time

9. Problems compiling using Compile-a3

10. RETRY: manipulating @INC at perl5 compile time (not script compile time)

11. Perl 5.6 regexp error message: Bug?

12. perl regexp questions


Powered by phpBB® Forum Software