Sorry this is quite a simple question but I am unable to google for it effectively.
Basically, I expect :s/\v\w+/foo/ to behave the same as :s/\v[\w]+/foo/ but the latter that puts \w within a character set does not match anything.
Is there a flag to enable this? is this not supported?
Thanks and sorry for the simplistic question. by the way, I know about [:alnum:] and things or that I could use [a-zA-Z] or something similar (possibly with underscores, I can't remember), but was looking for a way of using one consistent, quick notation.
No, you can't. You'll find that information at :help /[, actually near :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 []!
The equivalent collection for \w is [_[:alnum:]]. You can also combine \w with a collection, like this: \%(\w\|[...]\).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With