Re: ereg() can't recognize characters such as èéêë...
| From: | DvDmanDT | Date: | Mon, 29 Jul 2002 13:13:30 +0000 |
| Subject: | Re: ereg() can't recognize characters such as èéêë... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-157302@lists.php.net to get a copy of this message | ||
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&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
>
>