0

I am using this regular expression pattern "test(.*?\\.jpg)" in order to get the address to a JPG file out of a string . They all start with test...

Now I am facing following problem. Some of the links are ending with .JPG instead of .jpg.

How do I have to extend my regular expression to match .jpg and .JPG?

2 Answers 2

4

You can add (?i) at the beginning of the regex to make it case-insensitive:

"(?i)test(.*?\\.jpg)" 
Sign up to request clarification or add additional context in comments.

Comments

2

This should work: test(.*?\\.(?:jpg|JPG))

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.