[TxMt] Regex Questions (=Big confusion & massive problems)
Mats Persson
mats at imediatec.co.uk
Wed Mar 2 22:07:02 UTC 2005
OK, not sure how to explain this simply and clearly. So here goes :)
Reworking the CSS syntax file and I've decided to separate things like
this:
SELECTORS::
Main selector group should be grabbing anything in front of { but not {
begin = "[^} \\t{/@][^{]*?";
end = "(?=/\\*|\\{|\\s|$)";
Subpatterns
|-> selectors.html-elements = matching all HTML tags
|-> selectors.classes = UserDefined classes = matching any word with
a . in front of it
|-> selectors.id = UserDefined #Ids = matching any word with a # in
front of it
|-> selectors.pseudo-class = :hover, :link etc
PROPERTIES::
catching everything between the { } with the requisite sub-patterns.
begin = "\\{";
end = "\\}";
The problems I am having is that I can catch either the Selectors OR
the Properties, but NOT both at the same time.
The Selectors Regex above enables the Properties to work, but not the
Selectors.
Somehow lost the working regex for Selectors right now, but think I was
using:
begin = "^[^{]*?";
end = "(\\{)";
What am I doing wrong, where the hell is this thing falling apart
?????? I'm going nuts and has been on the verge of throwing the damn
thing out of the window. Please save my 'puter from an untimely death
: )
Going to sleep now, hoping for a better day tomorrow.
===================
Example Code:
/* a comment */
body {
/* inside properties comment */
properties: value;
}
div, .classname, #IDname:hover
{
/* inside properties comment here too */
properties: value;
}
/* another comment */
End Example Code:
Kind regards,
Mats
----
"TextMate, coding with an incredible sense of joy and ease"
- www.macromates.com -
More information about the textmate
mailing list