Notice the ?... The ? after the * is at least supposed to stop that problem... So preg_replace("#\{(.*?),(.*?)\}#","<a href=\"script.php?id=\\1\">\\2</a>",$whatever); should do what you want... :p
-- // DvDmanDT MSN: [EMAIL PROTECTED] Mail: [EMAIL PROTECTED] "Ivo Fokkema" <[EMAIL PROTECTED]> skrev i meddelandet news:[EMAIL PROTECTED] > Well, I tried that first, but it failed when some user whould list multiple > references. The ereg_replace would then take the two references as one. > "{PMID11519736:Müller}, {PMID8789442:Milasin}" would result in a link to > Müller named "Müller}, {PMID8789442:Milasin" instead of two separate > links... > > Thanks again! > > Ivo > > "Dvdmandt" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Also... You know, there's a (.*?) command as well.. Might work just about > > perfect in your situation... > > > > -- > > // DvDmanDT > > MSN: [EMAIL PROTECTED] > > Mail: [EMAIL PROTECTED] > > "Ivo Fokkema" <[EMAIL PROTECTED]> skrev i meddelandet > > news:[EMAIL PROTECTED] > > > Well d*mn, why didn't I think of this... It seems to work now! Thanks! > > > > > > I'm not such an expert on the Perl compatible regexp's so I rarely use > > > them... Yet another reason to start using them though... > > > > > > Thanx! > > > > > > "Dvdmandt" <[EMAIL PROTECTED]> wrote in message > > > news:[EMAIL PROTECTED] > > > > Use preg_*() functions then? Not that I think they would be much > better > > > > but... > > > > > > > > -- > > > > // DvDmanDT > > > > MSN: [EMAIL PROTECTED] > > > > Mail: [EMAIL PROTECTED] > > > > "Ivo Fokkema" <[EMAIL PROTECTED]> skrev i meddelandet > > > > news:[EMAIL PROTECTED] > > > > > Hi list, > > > > > > > > > > I read through the manual and tried to find something on google, but > I > > > > > didn't come to anything useful. > > > > > > > > > > It seems that the ereg()-family (I tried ereg(), eregi() and > > > > ereg_replace()) > > > > > can't recognize any special characters such as èéêë etc. I tested > this > > : > > > > > > > > > > <?php > > > > > print > > > > > > > > > > > > > > > (ereg("[[:alnum:][:alpha:][:blank:][:cntrl:][:digit:][:graph:][:lower:][:pri > > > > > nt:][:punct:][:space:][:upper:][:xdigit:]]","é")); > > > > > ?> > > > > > > > > > > and it returned a blank screen. When I fill in a regular character > > such > > > as > > > > > 'e' or a slash or whatever, it returns 1. I ran into this when I > > tested > > > a > > > > > script which should replace '{PMID[PubMed ID number]:[First author's > > > > name]} > > > > > into a link to the article online. For instance, > > > "{PMID12632325:Flanigan}" > > > > > results in "<A > > > > > > > > > > > > > > > href="http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=PubM > > > > > ed&dopt=Abstract&list_uids=12632325" > > > > target="_blank">Flanigan</A>". > > > > > > > > > > This worked all fine, until an author's name was Müller. Then my > > > > > ereg_replace() failed (below). Any ideas? > > > > > > > > > > <?php > > > > > $val = ereg_replace("{PMID([[:alnum:]. _-]*):([[:alnum:]. _-]*)}", > "<A > > > > > > > > > > > > > > > href=\"http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?cmd=Retrieve&db=Pub > > > > > Med&dopt=Abstract&list_uids=\\1\" > > > > > target=\"_blank\">\\2</A>","{PMID11519736:Müller}"); > > > > > print ($val); > > > > > ?> > > > > > > > > > > TIA! > > > > > > > > > > -- > > > > > [Win2000 | Apache/1.3.23] > > > > > [PHP/4.2.3 | MySQL/3.23.53] > > > > > > > > > > Ivo Fokkema > > > > > PHP & MySQL programmer > > > > > Leiden University Medical Centre > > > > > Netherlands > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php