0

I need to replace vanilla <a> tag by different tag (<router-link>) in whole project. The main problem is to do it with some conditions based on href value (e.g. it should ignore href with "#").

I wrote regex, but it was really massive and sometimes cause issues.

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Alexandr Vysotsky
  • 1,081
  • 13
  • 16

1 Answers1

2

After some research I found that webstorm(and other) has "Structural Replace" feature which help with it. I create follow structural replace: enter image description here enter image description here Main poins:

  • $before$ and $after$ have count filter = [0, infinity]
  • $before$ ignore 'href'
  • $href$ has script which filter some values
Alexandr Vysotsky
  • 1,081
  • 13
  • 16