Sunday, March 13, 2022

Re: New User -- regex question(s) ...

On 2022-03-09, LOSS PREVENTION <980beadvised@gmail.com> wrote:
> I have read, both http://www.vimregex.com/ -and- various sections of
> http://vimdoc.sourceforge.net/htmldoc/help.html. That said, I just can't
> figure out what I'm doing incorrectly. Please follow the live examples
> below:
>
> 1) Using \+ is not working for me in the following example -
> Original 01 --> Theft Attempted or Completed Offense? Completed
> Original 02 --> Theft Attempted or Completed Offense? Attempted
> Broken --> %s/\v\s(Attempted or Completed Offense\?)\s(\u\w\+)\s/,\1,\2,/g

With \v, you should use + instead of \+.

> I cannot find a written reason for this failure.

I have taken a quick look at the help of \v and, in fact, I cannot find that
difference explained in the table. Maybe, it should.

> --Next--
>
> %s/^M//g <--will work from the cmd-line, how do I do this from within a
><script>.vim?

That is an ex command: it works in exactly the same way in a script.

Life.

--
--
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/t0kt03%241659%241%40ciao.gmane.io.

No comments: