java - regex replacing URL for image file extension; replace spaces with plus -


i learning regex , looking search url possible image extension (jpg, jpeg, png, gif .. etc) , if file extension of url image.

i want replace %20 or spaces plus signs +

how can done?

www.test.com/this/is/an/image&20with%20spaces.jpg  www.test.com/this/is/an/image+with+spaces.jpg  

you'll have in 2 lines, way see it.

pattern imagepattern = pattern.compile("\\.(png|gif|jpg|jpeg)$", pattern.case_insensitive); if (imagepattern.matcher(input).find())   input = input.replaceall("(%20)|\\s", "+"); 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -