Please enable JavaScript to use regex101
/
^
r
e
g
e
x
[
\
-
_
]
?
1
0
1
$
/
i
Reg
ular
Ex
pressions
101
Upgrade to Pro
Enterprise
Regular Expression
/
(?:(?:\$|\$_|\.(?:find|prependTo|closest))\(\'|(?<!^)\G)\s?([-\w]+)?[^()\s.#]*(?=[^()]*\))|(?:\.(?:addClass|removeClass|toggleClass))\('(.*?)'\)
/
gm
Input 1
1
New
/** Get ID */ $('#aaa').show(); /** Get class */ $('.bbb').hide(); /** Get IDs and classes and ignore other symbols */ $('#ccc.ddd > .eee:[type=button]').empty(); /** Ignore other string but catch IDs and Classes*/ $('div #fff.ggg .hhh').addClass('iii jjj kkk'); /** Test multiple seletor in the same line */ $('#lll.mmm').$('#nnn.hhh'); /** Weird selector */ $('#yo-lo-how_are_you'); /** Final test */ $('#test').removeClass('caris avane aoi').addClass('shirone teameow');
Extraction
/** Get ID */ $('#aaa').show(); /** Get class */ $('.bbb').hide(); /** Get IDs and classes and ignore other symbols */ $('#ccc.ddd > .eee:[type=button]').empty(); /** Ignore other string but catch IDs and Classes*/ $('div #fff.ggg .hhh').addClass('iii jjj kkk'); /** Test multiple seletor in the same line */ $('#lll.mmm').$('#nnn.hhh'); /** Weird selector */ $('#yo-lo-how_are_you'); /** Final test */ $('#test').removeClass('caris avane aoi').addClass('shirone teameow');