Re: eregi_replace returns only lowercase
- From: Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@xxxxxxxxxxxxxxxx>
- Date: Mon, 03 Nov 2008 11:56:14 +0100
Bob schreef:
Erwin Moller
<Since_humans_read_this_I_am_spammed_too_much@xxxxxxxxxxxxxxxx> wrote in
news:490ece9d$0$184$e4fe514c@xxxxxxxxxxxxxx:
Bob schreef:Alex Eiswirth <Alex.Eiswirth@xxxxxxxxx> wrote inOver here:
news:937a06ac-e448-4a2e-9587-15a3bbca1ebc@xxxxxxxxxxxxxxxxxxxxxxxxxxx:
On Nov 3, 10:30 am, Bob <b...@xxxxxxxxx> wrote:ereg or eregi makes no difference in the output. In both cases itHi,p,
Maybe this problem has already been mentionned, but I am new to
this grouso here we go.t
$string = "This is for ABC only"
$new = (eregi_replace('ABC','<b>ABC</b>',$string));
print $new geeft nu
This is for <b>abc</b> only
where I would like to see 'abc' in uppercase. I have searched the
internefor the solution, consulted several PHP books, but can not find theHi Bob,
solution. Can anyone help? Thanks.
Bob
use ereg_replace instead of eregi_replace.
This function is identical to ereg_replace() except that this
ignores case distinction when matching alphabetic characters.
Alex Eiswirth http://www.eiswirth.de
returns in lowercase.
$string = "This is for ABC only";
echo eregi_replace('ABC','<b>ABC</b>',$string);
gives:
This is for <b>ABC</b> only
AND
$string = "This is for ABC only";
echo ereg_replace('ABC','<b>ABC</b>',$string);
gives:
This is for <b>ABC</b> only
Could you confirm this on your system Bob?
Just use THIS simple codefragmet, and leave the rest of your code out.
Regards,
Erwin Moller
Bob.
Hi Erwin (and others),
You are right, my question in the first place was incorrect. I tried to keep the problem short, but that corrupted the question.
In my example 'ABC' is actually a variable which is filled in by a user in a form. When he fills in 'abc' (lowercase, what most people do with key-words) php returns with 'abc'. When he fills in 'aBc' php returns with 'aBc' etc. Thus, the problem is, that I don't want to care how the user fills in (upper- or lowercase), but I want php to return the original value. Hope this makes the problem more clear.
Part of my script is:
$bkeyword="<font color=\"red\">$keyword</font>";
$occasion = (ereg_replace($keyword,$bkeyword,$occasion));
Bob.
Here is an example.
$string = "This is for AbC only";
echo eregi_replace('(ABC)','<b>\\1</b>',$string);
Read more here about \\1:
http://nl3.php.net/manual/en/function.eregi-replace.php
Regards,
Erwin Moller
--
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult."
-- C.A.R. Hoare
.
- References:
- eregi_replace returns only lowercase
- From: Bob
- Re: eregi_replace returns only lowercase
- From: Alex Eiswirth
- Re: eregi_replace returns only lowercase
- From: Bob
- Re: eregi_replace returns only lowercase
- From: Erwin Moller
- Re: eregi_replace returns only lowercase
- From: Bob
- eregi_replace returns only lowercase
- Prev by Date: Re: eregi_replace returns only lowercase
- Next by Date: Re: what to pick for RSS/Atom parsing
- Previous by thread: Re: eregi_replace returns only lowercase
- Next by thread: Re: eregi_replace returns only lowercase
- Index(es):
Relevant Pages
|