5 ms·
In vim: :%s/\<div\>/p/g (add C at the end if you want to confirm each change)
by stefco_ 7y ago
In vim: :%s/\<div\>/p/g (add C at the end if you want to confirm each change)
- allannienhuis 7y agoTIL what \< means. Thank you.
- deleted 7y ago[deleted]
- deleted 7y ago[deleted]
- nopacience 7y ago%s/<\(\/\?\)\(div\)>/<\1p>/g
- bch 7y agoHuh - that’s confusing in the context of this example, but indeed tests fine on my system (nvi). Since the “word” in question is “<div>”, I thought the \< was just an escape. I looked in various docs and the best I see in Tcl re_syntax(n) is \< and \> are synonyms for [[:<:]] and [[:>:]] respectively, which are constraints matching empty strings at the beginning and end of words, where a word a sequence of word characters... [a-zA-Z0-9_] TIL, too...
- stefco_ 7y agoRight? Totally nonintuitive! But easy enough to remember and type. I figured I wasn't the only one who found it a bit surprising ^_^