PCRE stumper (PHP preg_match_all) 
Author Message
 PCRE stumper (PHP preg_match_all)

In PHP, I have the following:

   preg_match_all("/begin [0-7]{3,4} (.+)\r?\n(.+)\r?\nend/Us", $data,
$matches);

this scans for UUEncoded attachments in the message body of an email and it
works great.  My problem is with optimizing it - the above will return the
following:

$matches[0] = one element for each UUEncoded part, full part
$matches[1] = one element for each UUEncoded part, filename
$matches[2] = one element for each UUEncoded part, full part with headers
stripped

the problem is that $matches[0] is pretty much the same as $matches[2], and
it uses twice the memory for no practical purpose.  Is it possible to have
it _not_ return the default 'matched' match ($matches[0])?  I'm thinking
that for large attachments (say, 8MB) this would be a significant waste of
memory.



Sun, 31 Jul 2005 04:12:03 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. preg_match_all: trim chars

2. Preg_match_all question

3. how to use preg_match_all ?

4. PCRE compatibility with ISE Eiffel 5.x

5. New release of PCRE module

6. ANN: pcre 0.1

7. pcre.error: ('regular expression too large)

8. python no module pcre

9. debug stumper: instruction got changed????

10. Browse totaling-A REAL STUMPER

11. indexing on foreign fields within relation - a real stumper

12. todays stumper!!

 

 
Powered by phpBB® Forum Software