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

Completado Publicado hace 5 años Pagado a la entrega
Completado Pagado a la entrega

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 Expresiones regulares

Nº del proyecto: #17965671

Sobre el proyecto

4 propuestas Proyecto remoto Activo hace 5 años

Adjudicado a:

kannanrbkr

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 Más

$10 USD en 1 día
(0 comentarios)
0.0

4 freelancers están ofertando un promedio de $17 por este trabajo

usman1493

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 en 1 día
(126 comentarios)
6.2
FlainFire

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 en 1 día
(0 comentarios)
0.0