Jump to content

rexex


ToonMariner

Recommended Posts

[!--quoteo(post=366058:date=Apr 18 2006, 11:55 AM:name=ToonMariner)--][div class=\'quotetop\']QUOTE(ToonMariner @ Apr 18 2006, 11:55 AM) [snapback]366058[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Been busy on here today!!!

OK a quicky

I want to replace "; "

with ;(carriage return)

that is a semi-colon and a carriage return (not the words!!!!! ;))

$string = preg_replace('/; /',';\r,$string);

aint working (tried \\r too)

Any help much appreciated
[/quote]

depending on what OS is running on your server, you have to have "\n" instead (*NIX servers), but just to be safe, your best bet is to use "\r\n" for all your carriage returns:

[code]
$String = preg_replace('|;|', ";\r\n", $String);
[/code]

i believe it also makes a difference that you use double quotes for the replacement so the escape characters are actually recognized.
Link to comment
https://forums.phpfreaks.com/topic/7737-rexex/#findComment-28234
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.