I'm an interaction designer in an Angular based HTML project. I'm trying to create a new HTML template based on one that's made by another team. I use Firebug to capture the existing HTML and modify it in Visual Studio Code.
Along with the HTML that is useful to me, I also get a ton of ng-
and cs-
tags, attributes, classes and comments that (I assume) was used to populate the template. I would like to remove them all.
At this point I have been successful at removing the comments, tags and attributes using the following regex:
(<!--.*(ngIf|ngRepeat|ngInclude).*-->)|(</{0,1}(ng|cs)-.*>)|((ng|cs)-[a-z-]*="[^"]*")
To break it down:
- Comments:
<!--.*(ngIf|ngRepeat|ngInclude).*-->
- Tags:
</{0,1}(ng|cs)-.*>
- Attributes:
(ng|cs)-[a-z-]*="[^"]*"
But for the time being I'm stuck at classes. I can find the things I want to remove: (class="[^"]*)ng-[-a-z]*([^"]*")
(limitation: removes only one ng-
class per class
attribute), but I can't replace them using \1\2
. It seems Visual Studio Code supports regex in the find field, but not in the replace field.
How to proceed?