title: Regex pattern for matching special characters in url
body: <p>I am trying to match url  in javascript using <code>match()</code> function, It takes regex as a pattern. I need to match special characters of url ( <code>://..:/.?=&amp;</code> )</p>
  
  <pre><code>var url = 'http://www.sun.com:80/index.html?q=1&amp;q2=2#fragment'; 
  </code></pre>
  
  <p>I have checked other pages but unable to find specific regex.
  and please also suggest good source to learn about writing regex.</p>
  
  <p>[Update]
  I am trying to break url in strings save into the array like (<code>string= ['http', '', '', 'www', 'sun', 'com', '80', 'index', 'html', 'q', '1', 'q2', '2']</code>) . For example - if pattern matches a variable saves the index position of url and then i use <code>slice()</code> function to extract the value ,my working url might be on different languages also (urdu etc) , i need to write regex for specific url symbols (:/.?=&amp;# ) </p>