Michael Fesser wrote:[color=blue]
> .oO(leegold2)
>
>[color=green]
>>preg_replace( ","," ",$kw_str2) ;
>>
>>This does not replace commas with spaces. What am I doing wrong?[/color]
>
>
> Missing delimiters, you should have received a warning (if not check
> error_reporting in your php.ini, it should be set to E_ALL).
>
> Possible solution: preg_replace('# ,#', ' ', $kw_str2); // # = delimiter[/color]
What? Could you explain, I thought I put a regex pattern in there -
what's this delimiter requirement?
I have never had any luck w/this function - it does not imo work like PERL.
[color=blue]
>
> But str_replace() would be more efficient in this case.
>
> Micha[/color]
> > Possible solution: preg_replace('# ,#', ' ', $kw_str2); // # = delimiter
[color=blue]
> I have never had any luck w/this function - it does not imo work like[/color]
PERL.
In Perl:
$kw_str2 =~ r#PATTERN#REPLA CEMENT#;
In PHP:
$kw_str2 = preg_replace('# PATTERN#', 'REPLACEMENT', $kw_str2);
Where in both PATTERN is an expression and REPLACEMENT is a string
"Perl-Compatible", not Perl.
The reason it is called "Perl-compatible regexp" resides in the PATTERN
part, wich use the same expression as in Perl.
Comment