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

Closed
pmichaud opened this Issue Jul 7, 2012 · 3 comments

Comments

Projects
None yet
2 participants
@pmichaud
Member

pmichaud commented Jul 7, 2012

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

This comment has been minimized.

Show comment
Hide comment
@TimToady

TimToady Jul 13, 2012

Member

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

Member

TimToady commented Jul 13, 2012

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

@pmichaud

This comment has been minimized.

Show comment
Hide comment
@pmichaud

pmichaud Jul 13, 2012

Member

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

Pm

Member

pmichaud commented Jul 13, 2012

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

Pm

@TimToady

This comment has been minimized.

Show comment
Hide comment
@TimToady

TimToady Jul 28, 2012

Member

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.

Member

TimToady commented Jul 28, 2012

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 in 76c977a Jul 28, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment