Dear users,
I have a string containing various characters. From that string I want to remove some characters like tabs and quotes.
I use this php code:
“`
<?
$str = ‘RegExr was created by gskinner.com, and is proudly hosted by Media Temple.
Edit the Expression & Text to see matches. Roll over matches or the expression for details. PCRE & JavaScript flavors of RegEx are supported. Validate your expression with Tests mode.
The side bar includes a Cheatsheet, full Reference, and Help. You can also Save & Share with the Community, and view patterns you create or favorite in My Patterns.
Explore results with the “Tools below. Replace & List output” custom results. Details’ lists capture groups. Explain des’cribes your expression in plain English.’;
echo preg_replace(‘/[cItvf”\’]/’, ”, $str);
?>
I created a draft on regexr at this link:
On that website, the newline character, not specified in regular expression, is left there. But in my php function, it is removed.
I don’t want to remove newline character from the string.
How can I fix?
Thanks