I did the below to simple fetch the domain along with the protocol. Example: https://www.facebook.com/profile/user/ ftp://182.282.34.337/movies/M
use the below Regex pattern : [a-zA-Z0-9]+://.*?/
will get you the output : https://www.facebook.com/ ftp://192.282.34.337/