Skip to main content
Module

x/denops_std/function/mod.ts>matchstrpos

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

Same as |matchstr()|, but return the matched string, the start position and the end position of the match. Example: :echo matchstrpos("testing", "ing") results in ["ing", 4, 7]. When there is no match ["", -1, -1] is returned. The {start}, if given, has the same meaning as for |match()|. :echo matchstrpos("testing", "ing", 2) results in ["ing", 4, 7]. :echo matchstrpos("testing", "ing", 5) result is ["", -1, -1]. When {expr} is a |List| then the matching item, the index of first item where {pat} matches, the start position and the end position of the match are returned. :echo matchstrpos([1, '__x'], '\a') result is ["x", 1, 2, 3]. The type isn't changed, it's not necessarily a String. Can also be used as a |method|: GetText()->matchstrpos('word')

Parameters

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

Returns

Promise<unknown>