0

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.

2 Answers 2

2

You can use the following regex:

[^/]+\.css

Or use \w which matches word characters:

\w+\.css

Live Demo

Sign up to request clarification or add additional context in comments.

2 Comments

@jugg1es it does, see above demo.
Short and sweet, +1 :)
1

If I were you I would use the following regex

[\w_\-]+\.css

Because the following inludes whitespace characters

[^/]+\.css

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.