" ingo/regexp/parse.vim: Functions around parsing patterns. " " DEPENDENCIES: " " Copyright: (C) 2020 Ingo Karkat " The VIM LICENSE applies to this script; see ':help copyright'. " " Maintainer: Ingo Karkat function! ingo#regexp#parse#MultiExpr() "****************************************************************************** "* PURPOSE: " Return a regular expression that matches any multi. "* ASSUMPTIONS / PRECONDITIONS: " None. "* EFFECTS / POSTCONDITIONS: " None. "* INPUTS: " None. "* RETURN VALUES: " Regular expression. "****************************************************************************** return '\%(\%(^\|[^\\]\)\%(\\\\\)*\\\)\@\|=\|!\|<=\|]\|_\^\|_\$\|%[\^$V#]\|%[<>]\?''.\|%[<>]\?\d\+[lcv]\)\|[\^$]\)' endfunction function! ingo#regexp#parse#NumberEscapesExpr() abort "****************************************************************************** "* PURPOSE: " Return a regular expression that matches any numbered escape; i.e. \%d; cp. " |E678|. "* ASSUMPTIONS / PRECONDITIONS: " Does not consider "very magic" (/\v)-style syntax. If you may have this, " convert via ingo#regexp#magic#Normalize() first. "* EFFECTS / POSTCONDITIONS: " None. "* INPUTS: " None. "* RETURN VALUES: " Regular expression. "****************************************************************************** return '\%(\%(^\|[^\\]\)\%(\\\\\)*\\\)\@