Quote:
Originally Posted by hidnana
I have uploaded the $key as a screenshot as I don't have the text version right now..., it's a big string concatenated by "|".
|
I had a feeling it was a bloaded regular expression, a regex optimizer is what you need.
You are giving egrep (which is a grep -E dedicated) a pile of 'check for this or this or this or this'. The form you have it in is quite unwieldy. If that could be reduced to this ...
Code:
TP-CAP-P[0-9]{9}-[0-9]{9}
If your not keen on the regular expression thing you can use a program like regex buddy to load your data in (or a dozen mb or so) and then test it.
Code:
TP-CAP-P123456789-103456789
TP-CAP-P124456789-103456789
TP-CAP-P123458789-123456709
TP-CAP-P123456789-123056719
TP-CAP-P123459989-123406789
and get a sense of the regex back (this is from mkregexp from just the above).
Code:
qr/(?=[1CPT])(?:1(?:23(?:4(?:5670|0678)9|056719)|03456789)|P12(?:345(?:[68]7|99)89|4456789)|(?:T|CA)P)/
My guess is that you want to do something else, but for what your doing a 30seconds isn't that bad for huge files.