Javascript Url Parser

Hello everyone!!
I am trying to build a URL parser using Javascript (Regex) that finds the URLs in the text
and opens them in a new tab. I ended up with this regular expression: ((([A-Za-z]{3,9}:(?://)?)(?:[-;:&=+$,\w]+@)?[A-Za-z0-9.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z0-9.-]+)((?:/[+~%/.\w-]*)???(?:[-+=&;%@.\w])#?(?:[\w]))?)
I just cannot really understand how I will include it in my function. Any suggestions would be invaluable!!!