in reply to What does it mean that a "pattern cannot be reversed?"
Simple patterns can be reversed: /foo/ can be reversed to /oof/.
Many more complex patterns can be reversed, though it isn't always obvious whether they'd match in exactly the same way: consider for example:
in which you might expect the parens to catch "ississip" (ie start the match at the earliest available position) rather than "ip"."mississippi" ~~ /p<after (i.*?p)>/; # reverse to /(p.*?i)/ ?? # or maybe /(p.*i)/ ??
However other examples cannot be reversed at all: in general, this might include anything that involves code assertions. Precisely what constitutes a reversible pattern has not yet been fully characterised, and to some extent it will depend on what we decide are the invariants that must be preserved as in the example above.
Hugo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: What does it mean that a "pattern cannot be reversed?"
by TimToady (Parson) on Jan 07, 2005 at 16:57 UTC | |
by tphyahoo (Vicar) on Apr 27, 2005 at 14:47 UTC |