Sunday, August 14, 2022

Re: Regex with backslashes in a collection

On 2022-08-13, arocker wrote:
> > I'm using Vim 8 or 9 with 'magic' and re=0 (same using re=1).
> >
> > I want to find "\[" or "\]" in text like:
> > abc\[def\]ghi\\xy\z
> >
>
> The problem may lie in the boundary of a character class, [ and ] and the
> rules about its content.
> Does the regex interpreter read [\[] as 2 characters, "\ or ]" or as one
> "literal ]"; or "literal \"? How is the following "]" parsed?

According to ":help /\]", [\[] is a collection containing two
characters, \ and [.

Regards,
Gary

--
--
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

---
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 email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20220814084134.GO12539%40phoenix.

No comments: