I have the pattern to get selectors of css code which are .classes, #ids and html tags. I used preg_match to sort them into an array just the name of the selector.
what happened is I get only the first selector twice, once with opened parentheses and again without.
This is the $contect:
body{ color: black; } .class_class { color: #fff; font: tahoma; } #awesome_id{ }
and this is the results:
Array
(
[0] => body{
[1] => body
)
this is the code:
<?php
#Patterns
$selectors = "/(\.?\#?-?[_a-zA-Z]+[_a-zA-Z0-9-]*\s*)\{/";
#Sort
preg_match($selectors, $content, $_selectors);
?>
<pre>
<?php
print_r($_selectors);
?>
</pre>
what i want -according to the content- is for the result to be like this
Array
(
[0] => body
[1] => .class_class
[2] => #awesome_id
)
