Regular expression for a valid css and / or jQuery selector

I need something like this:

Regex validSelector = new Regex("^[.#a-zA-Z0-9_:[] ]+[,><a-zA-Z0-9_~=\"\":[] ]*$");

Has anyone written a regex to test jQuery or CSS selectors? (CSS3 / jQuery1.4)

Or does anyone know where I can find the regex generator or regexp to test the jQuery selector? (or at least a CSS selector?)

I tried using the sizzle.js bu John Resig code and w3c docs for css (http: // www. W3.org/Style/CSS/), but in the end there was a headache: (

I think I would ask which of you have already written or used some fragment for this.

Thanks!!

+1
source share
2 answers

CSS 3 , . , .

+1

. ( .) , , , . StackOverflow .

+1

Source: https://habr.com/ru/post/1624743/


All Articles