NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP STRING QUESTION

Russ Demarest rsd at electronink.com
Tue Oct 19 14:22:47 EDT 2004


It is not elegant but you can try searching for the word lowercase, 
then search for it with an init cap then plural (add an s). Like I said 
not elegant but 90% sufficient.

Russ

On Oct 19, 2004, at 2:07 PM, Chris Bielanski wrote:

> Am I missing something? What about preg_replace()? Don't want to fight 
> with
> backreferences?
>
>
>
> Thanks,
> Chris Bielanski
> Web Programmer,
> International Trademark Association,
> 1133 Avenue of the Americas, 33rd Floor
> New York, NY 10036
> +1 (212) 642-1745, f: +1 (212) 768-7796
> mailto:cbielanski at inta.org, www.inta.org
> INTA -- 125 Years of Excellence
>
>
>
>> -----Original Message-----
>> From: Henry Ponce [mailto:henry at beewh.com]
>> Sent: Tuesday, October 19, 2004 1:59 PM
>> To: NYPHP Talk
>> Subject: Re: [nycphp-talk] PHP STRING QUESTION
>>
>>
>> Hi:
>>
>> This only helps if you use PHP 5.
>>
>> Is there a way to do what was asked with PHP 4??
>>
>> Thanx.
>>
>>
>> On Tuesday 19 October 2004 14:57, Matt Juszczak wrote:
>>> http://us2.php.net/manual/en/function.str-ireplace.php
>>>
>>> Hope that helps,
>>>
>>> Matt
>>>
>>> SALMAN MAZHAR wrote:
>>>
>>>> Hello everyone,
>>>>
>>>> My name is Salman Mazhar. I have a script that searches
>> for a keyword
>>>> in a text file. I am able to search the word using the stristr()
>>>> function in php. This function is non-case sensitive.
>> However, I want
>>>> to display the searched word in the line as highlighted
>> in a different
>>>> color than the line. I use the str_replace() function and
>> replace the
>>>> word with the word in red color but the str_replace() function is
>>>> case-sensitive. If I am searching for the word Computer
>> and I type in
>>>> upper case C, its only going to replace those instances
>> of computer
>>>> that begin with upper case C and leave the rest of them
>> without any
>>>> color change. Does anyone know how to get around this problem?
>>>>
>>>> Thanks.
>>>> Sincerely Yours,
>>>> Salman Mazhar.
>>>>
>>>>> From: csnyder <chsnyder at gmail.com>
>>>>> Reply-To: NYPHP Talk <talk at lists.nyphp.org>
>>>>> To: NYPHP Talk <talk at lists.nyphp.org>
>>>>> Subject: Re: [nycphp-talk] Automatically create an object
>> from a form
>>>>> Date: Tue, 19 Oct 2004 12:46:06 -0400
>>>>>
>>>>> You can also use dynamic javascript, a la Chris Hendry's
>> Paxi, see
>>>>> http://nyphp.org/content/presentations/paxi/index.php?slide=4
>>>>>
>>>>> You don't refresh the page, and you don't use XML-RPC -- you use
>>>>> javascript to append a new <script> element to the head of the
>>>>> document, which causes the browser to fetch the script
>> from the server
>>>>> and execute it. Doesn't work in Safari, tho (last we checked).
>>>>> _______________________________________________
>>>>> New York PHP Talk
>>>>> Supporting AMP Technology (Apache/MySQL/PHP)
>>>>> http://lists.nyphp.org/mailman/listinfo/talk
>>>>> http://www.newyorkphp.org
>>>>
>>>>
>>>> _________________________________________________________________
>>>> Express yourself instantly with MSN Messenger! Download
>> today - it's
>>>> FREE!
>> hthttp://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>>>>
>>>> _______________________________________________
>>>> New York PHP Talk
>>>> Supporting AMP Technology (Apache/MySQL/PHP)
>>>> http://lists.nyphp.org/mailman/listinfo/talk
>>>> http://www.newyorkphp.org
>>>>
>>>>
>>>> !DSPAM:417553d3421547084818123!
>>>
>>>
>>> _______________________________________________
>>> New York PHP Talk
>>> Supporting AMP Technology (Apache/MySQL/PHP)
>>> http://lists.nyphp.org/mailman/listinfo/talk
>>> http://www.newyorkphp.org
>>>
>>>
>>>
>>
>> _______________________________________________
>> New York PHP Talk
>> Supporting AMP Technology (Apache/MySQL/PHP)
>> http://lists.nyphp.org/mailman/listinfo/talk
>> http://www.newyorkphp.org
>>
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP)
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.newyorkphp.org
>




More information about the talk mailing list