Is there a way to allow \ w inside character sets in regex vim?

Sorry, this is a pretty simple question, but I cannot use it effectively.

Basically, I expect it :s/\v\w+/foo/to behave the same way :s/\v[\w]+/foo/, but the last one that puts \win the character set doesn't match anything.

Is there a flag to enable this? is this not supported?

Thank you and sorry for the simplified question. by the way, I know about [:alnum:]things and that I could use [a-zA-Z]or something similar (maybe with underscores, I don’t remember), but I was looking for a way to use one sequential fast recording.

+4
source share
1 answer

, . :help /[, :help /\]:

  - The following translations are accepted when the 'l' flag is not
    included in 'cpoptions' {not in Vi}:
    ...
    NOTE: The other backslash codes mentioned above do not work inside
    []!

\w [_[:alnum:]]. \w , : \%(\w\|[...]\).

+7

Source: https://habr.com/ru/post/1541418/


All Articles