SequencePosition
SequencePosition[list,sublist]
gives a list of the starting and ending positions at which sublist appears in list.
SequencePosition[list,patt]
gives all positions at which sequences matching patt occur in list.
SequencePosition[list,patt,n]
includes only the first n occurrences of patt.
Details and Options
- In SequencePosition[list,patt], patt can be an expression with head List that includes pattern constructs such as PatternSequence, Repeated (..), Blank (_), and BlankSequence (__).
- The pattern patt can also be a pattern that matches a list but does not itself have head List.
- With the default option setting Overlaps->True, SequencePosition includes sublists that overlap. With the setting Overlaps->False, such sublists are excluded.
- With Overlaps->All, multiple sublists that match the same pattern are all included. With Overlaps->True, only the first such matching sublist at a given position is included.
Examples
open allclose allBasic Examples (2)
Scope (5)
Options (2)
Properties & Relations (3)
Find the position of a sequence:
Replace the sequence by an expression:
For lists of characters, SequencePosition is very similar to StringPosition:
SubsetPosition matches the elements of the sequence in any order:
SequencePosition matches the sequence only in the specified order:
Text
Wolfram Research (2015), SequencePosition, Wolfram Language function, https://reference.wolfram.com/language/ref/SequencePosition.html.
CMS
Wolfram Language. 2015. "SequencePosition." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/SequencePosition.html.
APA
Wolfram Language. (2015). SequencePosition. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/SequencePosition.html