Skip to main content
Module

x/denops_std/function/mod.ts>matchstr

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

Same as match(), but return the matched string. Example:

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

results in "ing". When there is no match "" is returned. The {start}, if given, has the same meaning as for match().

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

results in "ing".

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

result is "". When {expr} is a List then the matching item is returned. The type isn't changed, it's not necessarily a String.

Can also be used as a method:

GetText()->matchstr('word')

Parameters

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

Returns

Promise<string>