I would like to get URLs given by user in his/her text (I assume that URL must be started with http://) . This is first attempt:
Pattern pattern = Pattern.compile("http://[^ ]+");
but if user types something like this:
"look at somepage (http://somepage.net)"
"look at http://somepage1.net, http://somepage2.net and sth else"
"Please visit our page http://somepage.net."
the URL was with incorrect(?) character at the end. How to avoid this?