Why are you using substr at all? There seems to be no need to do that, and if you don't use it, you'll only need the one regex (the first one) -- unless of course the data turns out to be malformed in some way.
But I would agree with the suggestion to use modules for this. In the long run, you'll be glad you did.
In reply to Re: Refactoring Regular Expressions
by graff
in thread Refactoring Regular Expressions
by logie17
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |