Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- RegEx's that you can use to match @media rules are:
- ^\@media\s(.*?)\{$
- ^ = assert position at start of the string
- \@ = matches the character @ literally
- media = matches the characters media literally
- \s = match any white space character [\r\n\t\f ]
- .*? = matches any character (except newline)
- { = matches the character { literally
- $ = assert position at end of the string
- \@media\s(.*?)\{
- \@ = matches the character @ literally
- media = matches the characters media literally
- \s = match any white space character [\r\n\t\f ]
- .*? = matches any character (except newline)
- { = matches the character { literally
- Also you can use the i to make the RegEx's case insensitive (i only ignores the case of [a-zA-Z])
- Here are four possible ways of detecting @media rules using RegEx:
- /^\@media\s(.*?)\{$/
- /^\@media\s(.*?)\{$/i
- /\@media\s(.*?)\{/
- /\@media\s(.*?)\{/i
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement