Re: ereg() can't recognize characters... [SOLVED]

From: Date: Tue, 29 Jul 2003 13:22:17 +0000
Subject: Re: ereg() can't recognize characters... [SOLVED]
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-157305@lists.php.net to get a copy of this message
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" <dvdmandt@telia.com> wrote in message news:20030729131313.85857.qmail@pb1.pair.com... > Use preg_*() functions then? Not that I think they would be much better > but... > > -- > // DvDmanDT > MSN: dvdmandt@hotmail.com > Mail: dvdmandt@telia.com > "Ivo Fokkema" <I.F.A.C.Fokkema@LUMC.nl> skrev i meddelandet > news:20030729130146.72616.qmail@pb1.pair.com... > > 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&amp;db=PubM > > ed&amp;dopt=Abstract&amp;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&amp;db=Pub > > Med&amp;dopt=Abstract&amp;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 > > > > > >

« previous php.general (#157305) next »