Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.