Skip to main content
Module

x/denops_std/function/mod.ts>matchend

📚 Standard module for denops.vim
Go to Latest
function matchend
import { matchend } from "https://deno.land/x/denops_std@v6.4.0/function/mod.ts";

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>