Can somebody help me with converting a PHP regex to Java format?

It would be great and I would appreciate if anyone could help me, because I'm not so strong in regex.

This is a PHP code:

```
$string = file_get_contents('a.txt');
$regex = '/\b(http|https):\/\/[-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i';
preg_match_all($regex, $string, $matches);
$urls = $matches[0];

```