I have a div that I am trying to run a regular expression on
<div class="module-header-content module-default">
I am using this replace operation that used to work,but now that I have added the module-header-content class it becomes problematic
replace(/module-\w+/gi, ' ');
I need a regular expression that removes all instances of module- except for module-header-content
Any help.
Thanks
The entire call:
var $target = $(this).parent().parent().parent().parent();
//// Removes all module-xxxx classes
var classes = $target[0].className.replace(/module-\w+/gi, '');
Try this:
It’ll get all classes except “module-header-content”.