| 10:27 am on Apr 24, 2009 (gmt 0)|
BTW I will need to search for the mailto link in the first place (in my PHP variable lets call it $thePage).
| 1:38 pm on Apr 24, 2009 (gmt 0)|
Unless I'm completely missing the point here, you don't need a regex at all. A simple string cat will do?
$myLink = 'mailto:#*$!?subject=yyy';
$myLink .= '&myparam=myval';
| 5:26 pm on Apr 24, 2009 (gmt 0)|
...but I still need to find the string in $thePage
| 8:42 pm on Apr 24, 2009 (gmt 0)|
I see. This regex will store the contents of the href property in $1: href=['"](.*?)['"]
As you may see it will work with single or double quotes.
| 8:47 pm on Apr 24, 2009 (gmt 0)|
Aaah thanks but we still need to put in the mailto itself, not just any http: https etc. :)
| 11:40 am on Apr 28, 2009 (gmt 0)|
I'm not sure what you mean? Your original post implies that you already have a mailto link?
ok, why don't you give me an example of the exact string you want to work on.
| 4:26 pm on Apr 29, 2009 (gmt 0)|
Kudos to D. for patience and persistence, I'd like to add it would be so much easier to provide a solution if you would just let us know the complete task behind your questions, from environment to input to output.
Where are these mailto's coming from? Static pages, other sites? Your output? A message board?
What is the real task you hope to achieve? Adding a new parameter to all mailto's?
There is one *huge* issue here that may make all this just not worth your time. Mailto links work only if the user has, and uses, a default mail program on their computer. The browser "queries" the system for the default mail program, opens it, and opens a new email populating the to, subject, and even body fields.
What if I use Yahoo Mail,Gmail, msn, AOL web mail, and have never launched Outlook, as an increasing number of users do?
The system does the same thing, most likely opening Outlook Express, and the reaction by the user ranges from confusion to horror (OMG, it's a pop up, it's a virus, what is this, I've never seen this . . . )
See where that goes?
So tell us what your actual task is, we could offer a *real* solution.
One example: find those mailto:links and substitute out the whole wad to point to a contact form that will work for everyone.
| 9:33 am on Apr 30, 2009 (gmt 0)|
|What if I use Yahoo Mail,Gmail, msn, AOL web mail, and have never launched Outlook |
You know, that's a really good point. I'd never have thought of that!
| 10:23 pm on Apr 30, 2009 (gmt 0)|
Not only that, if you are adding a custom parameter, the target program is likely simply going to ignore it.