Skip to content

Instantly share code, notes, and snippets.

@paceaux
Created January 5, 2021 17:07
Show Gist options
  • Save paceaux/70af01fd342d829068a67017cd11db9c to your computer and use it in GitHub Desktop.
Save paceaux/70af01fd342d829068a67017cd11db9c to your computer and use it in GitHub Desktop.
A Regex for finding a class name in html
/*
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