Skip to content

StringPosition

StringPosition("string", patt)

gives a list of starting and ending positions where patt matches "string".

StringPosition("string", patt, n)

returns the first n matches only.

StringPosition("string", {patt1, patt2,...}, n)

matches multiple patterns.

StringPosition({s1, s2, ...}, patt)

returns a list of matches for multiple strings.

See

Examples

>> StringPosition("123ABCxyABCzzzABCABC", "ABC")
{{4,6},{9,11},{15,17},{18,20}}
>> StringPosition("123ABCxyABCzzzABCABC", "ABC", 2)
{{4,6},{9,11}}

StringCases, StringContainsQ, StringCount, StringExpression, StringFreeQ, StringInsert, StringJoin, StringLength, StringMatchQ, StringPart, StringQ, StringReplace, StringRiffle, StringSplit, StringTake, StringToByteArray, StringTrim

Implementation status

  • ✅ - full supported

Github