Trying to write a rule to target any div meeting a regexp formula

edited July 2020 in Style Development [?]

I've been using a personal stylus rule for a long time, but so far I've only used relatively simple selector formulas (for example, div[class*="related"]). Now I'm trying to do something that requires regex; specifically, I want to apply a rule to divs with a z-index that contains 6 or more digits. I can't seem to find an example that uses regex for anything except a url.

The regex formula that would work is "z-index:[0-9]\d{6,}" (also "z-index: [0-9]\d{6,}").

But I don't know how to write the rule. I have tried variations:
'''div[style="z-index:[regexp[0-9]\d{6,}]''' -- which doesn't match anything,
and
'''div[style
=regexp("z-index:[0-9]\d{6,}")
div[style=[regexp("z-index:[0-9]\d{6,}")]
div[style
=(regexp("z-index:[0-9]\d{6,}")'''

I'm getting error messages like these for the last 3 attempts.
'''
error 103 : 12 Expected IDENT
error 103 : 13 Expected IDENT
error 103 : 13 Unexpected token 'regexp('
error 103 : 20 Unexpected token '"z-index:[0-9]\d{6,}"'
error 103 : 41 Unexpected token ')'
error 103 : 42 Unexpected token ']'
error 103 : 43 Unexpected token ','
error 104 : 12 Expected IDENT
error 104 : 12 Unexpected token '('
error 104 : 13 Unexpected token 'regexp('
error 104 : 20 Unexpected token '"z-index:[0-9]\d{6,}"'
error 104 : 41 Unexpected token ')'
error 104 : 42 Unexpected token ','
'''

I'm pretty sure there's some bracket &/or " that needs to be adjusted, but without an example to follow, I feel like I'm shooting in the dark.
Suggestions?

Comments

Sign In or Register to comment.