Skip to main content
Latest
function fn.matchend
import { fn } from "https://deno.land/x/denops_lsputil@v0.9.4/deps.ts";
const { matchend } = fn;

Same as match(), but return the index of first character after the match. Example:

:echo matchend("testing", "ing")

results in "7".

Vim doesn't have a strspn() or strcspn() function, but you can do it with matchend():

:let span = matchend(line, '[a-zA-Z]')
:let span = matchend(line, '[^a-zA-Z]')

Except that -1 is returned when there are no matches.

The {start}, if given, has the same meaning as for match().

:echo matchend("testing", "ing", 2)

results in "7".

:echo matchend("testing", "ing", 5)

result is "-1". When {expr} is a List the result is equal to match().

Can also be used as a method:

GetText()->matchend('word')

Parameters

denops: Denops
expr: unknown
pat: unknown
optional
start: unknown
optional
count: unknown

Returns

Promise<number>