Created
January 5, 2021 17:07
-
-
Save paceaux/70af01fd342d829068a67017cd11db9c to your computer and use it in GitHub Desktop.
A Regex for finding a class name in html
This file contains 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 characters
/* | |
where "title" is the full class name | |
/class=(.*[ "]title[ "].*)/g | |
*/ | |
const className = 'title'; | |
const regex = new RegExp(`/class=(.*[ "]${className}[ "].*)/g`); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment