lkchen

conditioned regex_replace

Jun 5th, 2014
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. bundle edit_line regex_replace_cond(find,replace)
  2. {
  3. vars:
  4.  
  5. "ereplace" string => escape("$(replace)");
  6.  
  7. classes:
  8.  
  9. "patched" expression => regline( ".*$(ereplace).*",
  10. "$(edit.filename)"
  11. );
  12. replace_patterns:
  13.  
  14. !patched::
  15.  
  16. "(?!$(ereplace))$(find)"
  17. replace_with => value("$(replace)"),
  18. comment => "Search and replace string conditional";
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment