Reputation: 1600
I want to get style.css
from this string using RegEx
http://domain.net/jitwp/wp-content/themes/strappress/style.css?ver=3.1.1
So far, I've tried \/(?:.(?!\/))
but it gets /style.css?ver=3.1.1
. I'm not sure how to ignore the query string at the end or skip the forward slash.
Upvotes: 0
Views: 61
Reputation: 70722
You can use the following regex:
[^/]+\.css
Or use \w
which matches word characters:
\w+\.css
Upvotes: 2
Reputation: 2634
If I were you I would use the following regex
[\w_\-]+\.css
Because the following inludes whitespace characters
[^/]+\.css
Upvotes: 1