Reputation: 12530
I'm trying to extract patterns like {THIS_PATTERN}
from something like the following:
.intro-header {
padding-top: 50px; /* If you're making other pages, make sure there is 50px of padding to make sure the navbar doesn't overlap content! */
padding-bottom: 50px;
text-align: center;
color: #f8f8f8;
background: url(../img/{BG_IMAGE_0}) no-repeat center center;
background-size: cover;
}
In this case it would be {BG_IMAGE_0}
.
I can't figure out what's wrong with my regex: \{[A-Z_]*\}
I have a regex101 fiddle here: https://regex101.com/r/KF5Sz6/2
Upvotes: 1
Views: 36
Reputation: 765
This should work:
\{[A-Z_0-9]*?\}
You didn't seem to take into consideration the "0".
By doing it like so *?
, you also make it non-greedy, which should prevent interference from other {
}
, on the same line, were you to stumble upon any in your future projects.
Upvotes: 3