Last active
July 28, 2022 23:42
-
-
Save jsmithdev/0fedd6a02565c383af3fc4477bc23f26 to your computer and use it in GitHub Desktop.
Revisions
-
jsmithdev revised this gist
Jul 28, 2022 . 1 changed file with 14 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,12 +1,17 @@ /** * @description Matches name of component - "ui-comp" from `<ui-comp class="ok">EVERYTHING</ui-comp>` * @return {Array} array of matches * @demo regexr.com/6qp3v **/ export function nameUse(s) { return s.match(new RegExp(/(?<=<)((\w*)(-\w*))(-\w*)*/, 'g')); } /** * @description Matches whole use of component `<ui-comp class="ok">EVERYTHING</ui-comp>` * @return {Array} array of matches * @demo regexr.com/6qp45 **/ export function wholeUse(s) { return s.match(new RegExp(/((<\w*)(-\w*).*)((.|\n)*)((<\/\w*)(-\w*).*)/, 'g')); } -
jsmithdev created this gist
Jul 28, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ /** * Matches name of component - "ui-comp" from `<ui-comp class="ok">EVERYTHING</ui-comp>`; Returns array of matches; * regexr.com/6qp3v **/ const reg = new RegExp(/(?<=<)((\w*)(-\w*))(-\w*)*/, 'g'); /** * Matches whole use of component `<ui-comp class="ok">EVERYTHING</ui-comp>`; Returns array of matches; * regexr.com/6qp45 **/ const reg = new RegExp(/((<\w*)(-\w*).*)((.|\n)*)((<\/\w*)(-\w*).*)/, 'g');