| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| The original NP Emo Kid Join Date: Jan 2005 Location: Plymouth, UK
Posts: 1,693
![]() ![]() ![]() ![]() ![]() ![]() | [php+regex] remove new lines Okay people say i have this: PHP Code: Is there a way to either remove any new lines directly in that or is there a way to ignore them and grab everything else?
__________________ Gaming On Linux - Because Linux is Fun! |
| | |
| | #2 (permalink) |
| Senior Member Join Date: Jul 2005 Location: NJ
Posts: 1,219
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | something like /[\n\r]/ as the regex for preg_replace to match new lines or even (to avoid regexes which have a high overhead) something like str_replace("\n\r", " ", $oldstring) Note that (i think) some os's uses \n\r while others use just \n (windows vs mac vs linux)
__________________ Hacksar.com - Your source for random computer tips and tricks! MySiteMemberships.com - Keep track of your site registration information! Like my post? Rep is appreciated! |
| | |
| | #3 (permalink) | ||||
| Tech Support Join Date: Mar 2005
Posts: 4,944
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Mac = \r Linux = \n | ||||
| | |