Reputation: 3724
I'm pretty close to what I need with this rubular:
http://rubular.com/r/tAzRj1H1z7
But, rather than selecting the whole block of which the lines are all indented with 4 tabs, I want to match the { that appears before the block.
Basically, this will allow me to search my codebase to find how many occurences of 4-tab blocks I have, rather than how many lines of 4-tab code.
/\t{4}.+/
.progressBar{
.progressBarRow {
.progressBarContainer {
.progress {
filter: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
border: #b9b9b9 1px solid;
height:40px;
}
}
}
}
Upvotes: 3
Views: 150
Reputation: 1208
\{(?=\s*\n\t{4}(?!\t))
Without (?!\t), you're counting 5 or more tabs blocks also.
Upvotes: 0
Reputation: 98826
You can reverse the question: Find the first {
that is followed by a line with four (or more) leading tabs. This regex does the trick:
\{\s*\n\t{4,}
If for whatever reason you really only want to match the {
itself, you can either put it in a group:
(\{)\s*\n\t{4,}
or use a look-ahead to make the whole match only {
:
\{(?=\s*\n\t{4,})
Upvotes: 1