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 …
<a href="mailto:[email protected],[email protected]">Some msg</a>
The regex should give me the mail addresses in mailto: link – [email protected], [email protected]. It should also support links like
<a href="mailto:[email protected]?subject=Comments from MailTo Syntax Page"> <a href="mailto:[email protected]?body=I am having trouble finding information on"> <a href="mailto:[email protected]?subject=MailTo Comments&[email protected]&[email protected]">
For a link like
<a href="mailto:value">tell a friend</a>
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.