Home Explore Blog CI



neovim

7th chunk of `runtime/doc/pattern.txt`
0b62786c5e1bf921c57963ae759d797611fbede6a55106790000000100000fa0
 putting "\m" or "\M" at the start of the pattern.

==============================================================================
4. Overview of pattern items				*pattern-overview*
						*E865* *E866* *E867* *E869*

Overview of multi items.				*/multi* *E61* *E62*
More explanation and examples below, follow the links.		*E64* *E871*

	  multi ~
     'magic' 'nomagic'	matches of the preceding atom ~
|/star|	*	\*	0 or more	as many as possible
|/\+|	\+	\+	1 or more	as many as possible
|/\=|	\=	\=	0 or 1		as many as possible
|/\?|	\?	\?	0 or 1		as many as possible

|/\{|	\{n,m}	\{n,m}	n to m		as many as possible
	\{n}	\{n}	n		exactly
	\{n,}	\{n,}	at least n	as many as possible
	\{,m}	\{,m}	0 to m		as many as possible
	\{}	\{}	0 or more	as many as possible (same as "*")

|/\{-|	\{-n,m}	\{-n,m}	n to m		as few as possible
	\{-n}	\{-n}	n		exactly
	\{-n,}	\{-n,}	at least n	as few as possible
	\{-,m}	\{-,m}	0 to m		as few as possible
	\{-}	\{-}	0 or more	as few as possible

							*E59*
|/\@>|	\@>	\@>	1, like matching a whole pattern
|/\@=|	\@=	\@=	nothing, requires a match |/zero-width|
|/\@!|	\@!	\@!	nothing, requires NO match |/zero-width|
|/\@<=|	\@<=	\@<=	nothing, requires a match behind |/zero-width|
|/\@<!|	\@<!	\@<!	nothing, requires NO match behind |/zero-width|


Overview of ordinary atoms.				*/ordinary-atom*
More explanation and examples below, follow the links.

      ordinary atom ~
      magic   nomagic	matches ~
|/^|	^	^	start-of-line (at start of pattern) |/zero-width|
|/\^|	\^	\^	literal '^'
|/\_^|	\_^	\_^	start-of-line (used anywhere) |/zero-width|
|/$|	$	$	end-of-line (at end of pattern) |/zero-width|
|/\$|	\$	\$	literal '$'
|/\_$|	\_$	\_$	end-of-line (used anywhere) |/zero-width|
|/.|	.	\.	any single character (not an end-of-line)
|/\_.|	\_.	\_.	any single character or end-of-line
|/\<|	\<	\<	beginning of a word |/zero-width|
|/\>|	\>	\>	end of a word |/zero-width|
|/\zs|	\zs	\zs	anything, sets start of match
|/\ze|	\ze	\ze	anything, sets end of match
|/\%^|	\%^	\%^	beginning of file |/zero-width|		*E71*
|/\%$|	\%$	\%$	end of file |/zero-width|
|/\%V|	\%V	\%V	inside Visual area |/zero-width|
|/\%#|	\%#	\%#	cursor position |/zero-width|
|/\%'m|	\%'m	\%'m	mark m position |/zero-width|
|/\%l|	\%23l	\%23l	in line 23 |/zero-width|
|/\%c|	\%23c	\%23c	in column 23 |/zero-width|
|/\%v|	\%23v	\%23v	in virtual column 23 |/zero-width|

Character classes:					*/character-classes*
      magic   nomagic	matches ~
|/\i|	\i	\i	identifier character (see 'isident' option)
|/\I|	\I	\I	like "\i", but excluding digits
|/\k|	\k	\k	keyword character (see 'iskeyword' option)
|/\K|	\K	\K	like "\k", but excluding digits
|/\f|	\f	\f	file name character (see 'isfname' option)
|/\F|	\F	\F	like "\f", but excluding digits
|/\p|	\p	\p	printable character (see 'isprint' option)
|/\P|	\P	\P	like "\p", but excluding digits
|/\s|	\s	\s	whitespace character: <Space> and <Tab>
|/\S|	\S	\S	non-whitespace character; opposite of \s
|/\d|	\d	\d	digit:				[0-9]
|/\D|	\D	\D	non-digit:			[^0-9]
|/\x|	\x	\x	hex digit:			[0-9A-Fa-f]
|/\X|	\X	\X	non-hex digit:			[^0-9A-Fa-f]
|/\o|	\o	\o	octal digit:			[0-7]
|/\O|	\O	\O	non-octal digit:		[^0-7]
|/\w|	\w	\w	word character:			[0-9A-Za-z_]
|/\W|	\W	\W	non-word character:		[^0-9A-Za-z_]
|/\h|	\h	\h	head of word character:		[A-Za-z_]
|/\H|	\H	\H	non-head of word character:	[^A-Za-z_]
|/\a|	\a	\a	alphabetic character:		[A-Za-z]
|/\A|	\A	\A	non-alphabetic character:	[^A-Za-z]
|/\l|	\l	\l	lowercase character:		[a-z]
|/\L|	\L	\L	non-lowercase character:	[^a-z]
|/\u|	\u	\u	uppercase character:		[A-Z]
|/\U|	\U	\U	non-uppercase character		[^A-Z]
|/\_|	\_x	\_x	where x is any of the characters above: character
			class with end-of-line included
(end of character classes)

      magic   nomagic	matches ~
|/\e|	\e	\e	<Esc>
|/\t|	\t	\t	<Tab>
|/\r|	\r	\r	<CR>
|/\b|	\b	\b	<BS>
|/\n|	\n	\n	end-of-line
|/~|	~	\~	last given substitute string
|/\1|	\1	\1	same string as matched by first \(\)
|/\2|	\2	\2	Like "\1", but uses second \(\)
	 

Title: Vim Regular Expression Pattern Items: Multi, Ordinary Atoms, and Character Classes
Summary
This section provides an overview of various pattern items in Vim regular expressions, focusing on multi items (quantifiers like *, +, ?, and their non-greedy counterparts), ordinary atoms (like beginning/end of line, any character, word boundaries), and character classes (like \i for identifier characters, \s for whitespace, \d for digits). It explains the differences in behavior based on the 'magic' option and provides a table listing these items with their 'magic' and 'nomagic' equivalents.