Forums / General / Strip \n characters from a string

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

Strip \n characters from a string

Author Message

Alejandro Serrano

Friday 22 September 2006 9:43:11 am

Hi,
I need to strip all '\n' and '\r' characters from a string, or replace it with a space. How can I do it with Exponential?

Thanks in advance.

Claudia Kosny

Friday 22 September 2006 1:41:50 pm

Hello Alejandro

I fyou just want to trim the string (i.e. remove whitespace from the beginning and of the string), use the trim operator. If you want to remove whitespace from the middle of the string you might need a preg_replace functionality, which is offered by this extension:

http://ez.no/community/contribs/template_plugins/reg_ex_replace

Greetings from Luxembourg

Claudia