Check If a String Contains a URL Using Java

preview_player
Показать описание
Check If a String Contains a URL Using Java

Greetings, I'm back with another tutorial where we check if a string contains a valid url which could be handy for input validation, checking for links for a twitch bot or Minecraft server or anything else. This code could also be modified to check if a string is a valid url. I hope this quick tutorial helps!

Here is the regex I used: ((http:\\/\\/|https:\\/\\/)?(www.)?(([a-zA-Z0-9-]){2,}\\.){1,4}([a-zA-Z]){2,6}(\\/([a-zA-Z-_\\/\\.0-9#:?=&;,]*)?)?)

 Why not subscribe to keep notified when I upload?

Check If a String Contains a URL Using Java
Рекомендации по теме
Комментарии
Автор

By the ways guys, I'm not sponsored by 2b2t, I just wanted to say FitMC's iconic line from his videos.

maxodidily
Автор

Oh dude, *This is actually working*, I was looking for sooo long! Leaving a like also

shateq
Автор

I like your videos they help me Alot in Projects, College is hard but once you get hold of the syntax of Java or any other Language it gets easier


So thanks for all the help even though you didn't intentionally help😅 but youre appreciated

RealDavidxD
Автор

Hi, how can I check if the string contains multiple urls? Thanks in advance

piyushsehgal
Автор

It would be perfect if you tell us how did you writed line 21! What are the rules of that part of code?! Thanks👌

amir.g
Автор

Can you write a tic tac toe A.I(player vs cpu) in your next video?!🤔

amir.g