Possible Duplicates:
Parsing CSS in JavaScript / jQuery
Parsing CSS string with RegEx in JavaScript
How can I find out if a string contains CSS rules?
Example rules:
selector {
property:value;
}
selector { property:value; }
selector{property:value}
...
Basically I want to find out if a text block represents either PHP + HTML or CSS code.
One way to do this - I was thinking to trim the text, then match the first character of the text with #
, .
or a CSS selector such as body
, p
etc. DO you think it's a good idea?