Reputation: 3020
I need to match CSS as string.
#
character (Id)."body"
, "li"
, "ol"
, "ul"
."body"
, "li"
, "ol"
, "ul"
."selector li"
."li, ol, ul"
as part of it. For example "lololol"
shouldn't match it.I attempted doing it like this:
/^(\s)*|ol|ul|body|#|li|$/g
But is still not matching properly.
I'm using https://regex101.com/
to test it.
Upvotes: 0
Views: 28
Reputation:
Just use \b to delimit the word boundary:
^(\s)*|\bol\b|ul|body|#|li|$(\s)*
Upvotes: 1