I have this\(\w[^\w\u370-\u3ff\u1f00-\u1fff]*\)\([\u370-\u3ff\u1f00-\u1fff][^\w]*[\u370-\u3ff\u1f00-\u1fff]\)\([^\w]*\w\),which I need to improve, but it is getting uncomfortably complicated; is it possible to define shorthands for expressions that are reused, such as \u370-\u3ff\u1f00-\u1fff? or is there some other way to make this easier to work with?
Can one define shorthands for unicode ranges?
regular expression
You can define a variable holding your pattern like this::let g:pat='...'(Note the use of single quotation marks, to prevent side-effects).Then you can search for that variable like this::%s/<C-R>=g:pat<cr>/replacement_part/g This is described at :h c_CTRL-R_=or possibly easier::exe '%s/'.g:pat.'/replacement/g' (you could also wrap this in a printf() call)