Reply to Re: [PHP] Finding first/last occurrence of a substring

Your name:

Reply:


Posted by Benjamin Edwards on 01/17/05 18:46

You need to use regular expresions, I think there is a regex_replace frunction (or something like that).

http://etext.lib.virginia.edu/helpsheets/regex.html is a fairly good introduction to regular expresions - learn to love them ;)

>>> Vikram Vaswani <mister_freehand@yahoo.com> 01/17/05 03:27pm >>>
Hi
I have a string like this:
----
Just when you begin to think the wagon of Vietnam-grounded movies is grinding to a slow halt, you're hit squarely in the face with another one. However, while other movies depict the gory and glory of war and its effects, this centres on the psychology of troopers before they're led to battle.
----
I need to know the index position of every occurrence of the pattern "the" in the string above, and replace it with something else. Specifically, I need the position of the last, first and third occurrences of "the".

I'm totally lost as to how to do this. Could someone help me out?

TIA,

Kam



---------------------------------
Do you Yahoo!?
Yahoo! Mail - You care about security. So do we.

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________


______________________________________________________________________
This email and any files transmitted with it are confidential. It is for the intended recipient only. If you have received the email in error please notify the author by replying to this email. If you are not the intended recipient, you must not disclose, distribute, copy, print, or rely on this email. Any views expressed by an individual within this email which do not constitute or record professional advice relating to the RNLI, do not necessarily reflect the views of the organisation.

Registered Charity Number 209603

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация