Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Interaction of :pos with :g (and :ov and :ex) in match #16

Closed
pmichaud opened this Issue · 3 comments

2 participants

@pmichaud
Owner

What should be the result of the following...?

say 'abcd'.match( /./, :pos(1), :global);

Should it:
1. return only the one match that is anchored at position 1,
2. return all matches, anchoring only the first one, or
3. return the match anchored at position 1, and all subsequent matches anchored to the previous match?

Similar considerations may hold for the :nth and :x modifiers.

Thanks!

Pm

@TimToady
Owner

The only effect of :pos is to set the starting position. :pos(0) is a no-op, in other words.

@pmichaud
Owner

So, just to confirm: when :global, :overlap, :nth, or :x are set, then :pos($n) acts exactly like :c($n) would?

Pm

@TimToady
Owner

Sorry, was confusing :p with :c due to either illness or stupidity (or both). :p will anchor, so only :ex has any effect (return all anchored variations). All other modifiers should fail with :p, pointing toward use of :c instead.

@TimToady TimToady closed this issue from a commit
@TimToady TimToady :p is incompatible with scanners
:p may not be used with :ex, :ov, :g, :nth, or :x modifiers.
fixes #16
76c977a
@TimToady TimToady closed this in 76c977a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.