Pattern or regex in Java to delete the hyperlinks in the text descritpion

I have a text about a product description .

I want to delete the hyperlinks but i want to keep the <img links .

1- I was able to delete the hyperlinks from the text

by using this Java function

private String removeUrl(String commentstr)


String urlPattern = "((https?|ftp|gopher|telnet|file|Unsure):((//)|(\\\\))+[\\w\\d:#@%/;$()~_?\\+-=\\\\\\.&]*)";

Pattern p = [login to view URL](urlPattern,Pattern.CASE_INSENSITIVE);

Matcher m = [login to view URL](commentstr);

StringBuffer sb = new StringBuffer([login to view URL]());

while ([login to view URL]()) {

[login to view URL](sb, "");


return [login to view URL]();


2- I need it to exclude hyperlinks that are images , So something you can write to exclude delete links that ends with png, jpg or such . you choose the way you want

Навички: Java, Регулярні вирази

Деталі: java code parse text file database, java write class text file, java examples parse text, java regex match url path, java string contains regex, java regex matcher, java string matches regex, java regex online, java regex replace pattern, java regex example, java regex special characters, java socket server text file, delete backgrounds text, java parser class text, java input chinese text field, java class parsing text files, picture image pattern recognition java source code, writing java app parse text file, java code parse text file, java search parse text

Про роботодавця:
( 23 відгуки(-ів) ) Stockholm, United Arab Emirates

ID Проекту: #17965671



Hi, I am a web developer with 8+ years of experience. To remove image urls from a comment, there are several ways to do it. One such way is to check the image extension that way will be more robust. Couldn't able Більше

$10 USD за 1 день
(0 відгуків(-и))

4 фрілансерів(-и) у середньому готові виконати цю роботу за $17


Hey A Java expert developer is here I have good advanced expertise in Java and Javafx I can help you in your regex task This is an initial bid Feel free to message me Regards

$30 USD за 1 день
(126 відгуків(и))

Hi, This is Vaibhav I have experience in making a desktop application using java [login to view URL]!AjQ_3RyyWk98oEj7yMTI4Uxkg1ET CNC simulator [login to view URL]!AjQ_3RyyWk98oBVPlMYWfdxp5bbp Custom music player ht Більше

$13 USD за 1 день
(13 відгуків(и))

Hello Hope you are well. I can write to you such an regex for an one day. Just accept me. Best regards, Alex.

$15 USD за 1 день
(0 відгуків(и))