Pattern or regex in Java to delete the hyperlinks in the text descritpion
$10-30 USD
Completed
Posted over 5 years ago
$10-30 USD
Paid on delivery
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
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 to chat with you. My messages are not delivered.
$10 USD in 1 day
0.0 (0 reviews)
0.0
0.0
4 freelancers are bidding on average $17 USD for this job
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