UnCSS ignore classes with regex

637 Views Asked by At

I need to match this bootstrap classes:

    '.col-lg-1',
    '.col-lg-2',
    '.col-lg-3',
    '.col-lg-4',
    '.col-lg-5',
    '.col-lg-6',
    '.col-lg-7',
    '.col-lg-8',
    '.col-lg-9',
    '.col-lg-10',
    '.col-lg-11',
    '.col-lg-12',
    '.col-md-1',
    '.col-md-2',
    '.col-md-3'

this in the gulpfile works.

When I try to do the same with regex:

'/.col-([a-zA-Z0-9]+)-([a-zA-Z0-9]+)/'

the classes are not ignored. I have checked the expression here: http://regexr.com/3f7ka

Whan am I doing wrong? Thank you.

1

There are 1 best solutions below

1
On

Removing surrounding apostrophe and doing global with g, it works:

/\.col-([a-zA-Z0-9]+)-([a-zA-Z0-9]+)/g,

https://stackoverflow.com/a/36358570/2986401