At 14:57 15.01.2001 +0100, Cynic wrote:
>this one is really easy:
>
>$ret = preg_replace( '/(?!boy)s/' , 'girl' , $text ) ;

<?php
  $string = "boys, boy, fort boyard";
  $string = preg_replace("/boy(?!\w)/", "girl", $string);
  print $string;
?>

should be correct.

daniel


>At 12:34 15.1. 2001, adam wrote the following:
>--------------------------------------------------------------
> >Toby Butzon <[EMAIL PROTECTED]> said:
> >
> >> lol...
> >>
> >> Ok, so you want to replace ONLY the word "boy" with the word "girl"... you
> >> don't want to touch "boys".
> >>
> >> Perhaps str_replace("boy ", "girl ", $myStr) would do the trick?
> >>
> >No, I thought of that - if the word is up against a fullstop or comma (or
> >something else), that won't work. A regular expression will need to be 
> used,
> >and since I'm no good at them I can't make a suggestion. Sorry. :)
> >
> >adam
> >
> >
> >--
> >PHP Windows Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >To contact the list administrators, e-mail: [EMAIL PROTECTED]
>------end of quote------
>
>
>
>____________________________________________________________
>Cynic:
>
>A member of a group of ancient Greek philosophers who taught
>that virtue constitutes happiness and that self control is
>the essential part of virtue.
>
>[EMAIL PROTECTED]
>
>
>
>--
>PHP Windows Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


/*--
daniel beulshausen - [EMAIL PROTECTED]
using php on windows? http://www.php4win.de


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to