Regular expressions are used in any language, but not in the same form.
CSS is also a language and has its own regular expressions
Some general rules in regular expressions:
1 ^ indicates string start position match
2 $ indicates a match until the end of the string
3 * Indicates arbitrary position matching of string
4 I means string matching is case insensitive
5 g = String Global match
CSS Property selector and regular expression:
1 [attr= "Val"] Select attr attribute value only for Val element <div attr= "val"/>
2[ATTR] Select the element that has attr this attribute (case-sensitive) <div attr= "val"/> <div attr/> <div attr= "val5435454"/>
3 [attr~= "Val"] Select the attribute is attr, and the attribute value contains the Val word element (case-sensitive) <div attr= "text val"/> <div attr= "val"/ > | | Error: <div attr= "Val-ue"/> <div attr= "value"/>
4 [attr$= "val"] Select attribute attr The value end of the Val character element (case-sensitive)<div attr= "text val"/> <div attr= "val"/ > <div attr= "434val"/> | | Wrong: <div attr= "val323"/> <div attr= "Val-ue"/>
5[attr^= "Val"] Select the value of the attribute attr begins with the Val character element (case-sensitive)<div attr= "val"/> <div attr= "Val-ue"/> <div attr= "Value"/>| | Wrong: <div attr= "text val"/>
6 [attr*= "Val"] Select the value of the attribute attr any position containing the Val character element (case-sensitive)<div attr= "text val"/> <div attr= "val"/ > <div attr= "val-ue"/> <div attr= "value"/>
7 [attr|= "Val"] Select the value of the attribute attr begins with the word val or the element for the val- word (case-sensitive)Div attr= "val"/> <div Attr= "Val-ue"/> | | Error: <div attr= "val text"/> <div attr= "text val"/> <div attr= "value"/>
8 [attr*= "Val" i] or [attr*= "Val" i] Select the value of the attribute attr any location containing Val or Val or Val or Val or Val characters ( case-insensitive) elements <div Attr= "text val"/> <div attr= "val"/> <div attr= "Val-ue"/> <div attr= "value"/><
Div attr= "val"/> <div attr= "val"/><div attr= "val"/> <div attr= "val"/>
Currently, Chrome, FireFox, Safari already supports i
regular, but IE does not support case-insensitive, and other property selector ie7+ support
Regular expressions in the CSS selector