in reply to Re^5: Possible to have regexes act on file directly (decompose regex)
in thread Possible to have regexes act on file directly (not in memory)
If I have understood you correctly (I think I did), this is IMHO no longer a straight regex pattern match, but this is really becoming a very basic parser using several regexes. Or it can be viewed as building your own very basic custom pseudo-regex engine in pure Perl, using Perl's built-in regex engine for matching the various components of the original regex pattern.
Yes, I believe that this can indeed work on a number of cases, but this can quickly become hairy for somewhat complicated patterns having more than one * or + quantifiers, alternations, captured matches, look-around assertions, etc. I have actually built a few times very primitive parsers using several regexes to parse progressively data that I could not figure out how to analyze with a single regex. This works, but this means that if the pattern changes, then you don't only need to change the pattern, but you also probably need to write different code around it.
But all this is really speculation so long as the OP does not tell us which kind of regexes she or he wants to use.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Possible to have regexes act on file directly (decompose regex)
by LanX (Saint) on May 02, 2014 at 21:55 UTC |