Am 19.12.2012 04:58, schrieb Tim Chase:
%s/\c<\s*a\s\+href\s*=\(['"]\)\(\%(\1\@![^/]\)\+\)\1\s*>\([^<]*\)</\=WriteShortcut(submatch(0), submatch(3), submatch(2))/g
Now we have automatic explanation of such patterns: :ExplainPattern \c<\s*a\s\+href\s*=\(['"]\)\(\%(\1\@![^/]\)\+\)\1\s*>\([^<]*\)< Pattern: \c<\s*a\s\+href\s*=\(['"]\)\(\%(\1\@![^/]\)\+\)\1\s*>\([^<]*\)< \c ignore case while matching the pattern < literal string (1 atom(s)) \s whitespace character: <Space> and <Tab> * (multi) zero or more of the preceding atom a literal string (1 atom(s)) \s whitespace character: <Space> and <Tab> \+ (multi) one or more of the preceding atom href literal string (4 atom(s)) \s whitespace character: <Space> and <Tab> * (multi) zero or more of the preceding atom = literal string (1 atom(s)) \( start of first capturing group | ['"] collection \) end of group \( start of second capturing group | \%( start of non-capturing group | | \1 match first captured string | | \@! (assertion) forbid match for preceding atom | | [^/] collection | \) end of group | \+ (multi) one or more of the preceding atom \) end of group \1 match first captured string \s whitespace character: <Space> and <Tab> * (multi) zero or more of the preceding atom > literal string (1 atom(s)) \( start of third capturing group | [^<] collection | * (multi) zero or more of the preceding atom \) end of group < literal string (1 atom(s)) looks better with color, see http://www.vim.org/scripts/script.php?script_id=4364 happy vimming :-) (or just :ExplainPattern * if the pattern is in the clipboard) (needless to say: suggestions welcome) -- Andy -- 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
