I have a stylesheet:
a,b,c { stuff
lots of it
}
b { more stuff }
.test { even more }
I want a regular expression to break it up into each of the three parts, separating from ‘}’ to ‘}’ should work alright for my needs (except the first case obviously).
In Ruby 1.9, you could
i.e., split the string at a position following a
}. Ruby 1.8 doesn’t support lookbehind assertions, though, so it won’t work there. And of course you’ll be running into problems with nested braces, but you said that this shouldn’t be a problem with your data.In Ruby 1.8 (can’t try it here), the following should work:
although now the closing braces won’t be part of the matched elements anymore. So
test {a} test2 {b}will be split intotest {a,},test2 {b,}plus an empty string.