Re: pattern syntax for match()

Christian Brabandt <[email protected]> Wed, 25 Mar 2026 20:41:15 +0100
Newsgroups gmane.editors.vim
Message-ID <[email protected]>
On Mi, 25 M=C3=A4r 2026, Tim Chase wrote:

> On 2026-03-25 12:01, S. Cowles wrote:
> > i would like to do the following operation:
> > 	let m =3D match( "foo" , "foo\|beep" )
> > however, i get no match.  (m is (-1).)
> > what is the correct pattern syntax to enable this match?
>=20
> Because they're strings, do you need to escape the "\", making it
>=20
>   let m =3D match( "foo" , "foo\\|beep" )

Or a bit more readable, use single quotes instead.

Thanks,
Christian
--=20
Are we not men?

--=20
--=20
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---=20
You received this message because you are subscribed to the Google Groups "=
vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/vim_use/acQ=
6W0dcgdWjG1p2%40256bit.org.