Skip to content
Advertisement

JavaScript, regex: How to fetch mail address in mailto: links

Is there a jquery plugin or may be a regex which can be used to all the fields in query string of a mailto: link. It should support the mailto syntax.

Say if I have a link like …

JavaScript

The regex should give me the mail addresses in mailto: link – astark1@unl.edu, id@internet.node. It should also support links like

JavaScript

For a link like

JavaScript

I would pass value and the function and get an associative array of email addresses and other fields passed in query string.

Advertisement

Answer

Parsing URLs, and especially their query strings, is not a job for regexes. You could use a proper URL-parsing library or perhaps just a query string parsing one.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement