Regular expression in Javascript

Getting url id from regular expression is very useful.


The regular expression /[?/]/ matches either  '?' or  '/' character. In JavaScript, a regular expression is written between two forward slashes / and can be used with the split() method to split a string into an array based on a specified pattern.

For example, if the string "a?b/c" is split using the regular expression /[?/]/, it will result in the following array:
 ["a", "b", "c"].

In the same way, If the string is "a?b/c&g$k" and the regular expression is /[?/&$]/, the result of splitting the string using this regular expression will be:
["a", "b", "c", "g", "k"]

 Its very helpful in retriveing url id from facebook/instagram/youtube/twitter etc in downloading process..