473,388 Members | 1,552 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

How can i replace CRLF and Tabulation with space

132 100+
so i have this string;
"ContenuCRLF
text1

text2 "

and i want the first CRLF and tabulation replace by space i want use experssion reguler but i don't know

Thanks in advance
Dec 8 '15 #1
9 1468
Dormilich
8,658 Expert Mod 8TB
no need to use a RegExp. use str_replace().
Dec 9 '15 #2
manjava
132 100+
i used that
Expand|Select|Wrap|Line Numbers
  1. preg_replace('/(^.+)(\r\n\t)/ime', "str_replace('$2', ' ', '$0')", $text)
for this string http://i.stack.imgur.com/UasBL.png

but not worked for me .thanks in advance
Dec 9 '15 #3
Dormilich
8,658 Expert Mod 8TB
but not worked for me
you’re making that way to complicated. as I said you don’t even need regular expression. just the str_replace() function will do.
Dec 9 '15 #4
manjava
132 100+
yes i used just the str_replace
Expand|Select|Wrap|Line Numbers
  1. echo str_replace(chr(13).chr(10).chr(9), ' ',  $chaine);
and also
Expand|Select|Wrap|Line Numbers
  1. echo str_replace("\r\n\t", ' ',  $chaine);
but not worked for me thanks in advance
Dec 9 '15 #5
Dormilich
8,658 Expert Mod 8TB
but not worked for me
I explained to you last time why that didn’t work and I also pointed out a solution.
Dec 9 '15 #6
manjava
132 100+
i var_dumped the output and copy to notpad++ and see nothing change i have the same of the string
Dec 9 '15 #7
Dormilich
8,658 Expert Mod 8TB
I told you why.
Dec 9 '15 #8
manjava
132 100+
i don't know i do
Expand|Select|Wrap|Line Numbers
  1. $var=str_replace(chr(13).chr(10).chr(9), ' ',  $chaine); 
i
Expand|Select|Wrap|Line Numbers
  1. var_dump($var);
i have the same of my screen shot nothing change
Dec 9 '15 #9
Dormilich
8,658 Expert Mod 8TB
it would help to actually read the documentation of str_replace() because the solution is demonstrated right in the first example (block).
Dec 9 '15 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: McKirahan | last post by:
How would I use a regular expression to remove all trailing Carriage Returns and Line Feeds (%0D%0A) from a textarea's value? Thanks in advance. Also, are they any great references for learning...
5
by: j1c | last post by:
Does anyone have an example of how to replace all whitespace at the end of a string?? I'm trying something like: do while right(str,1) = " " str = replace(right(str,1)," ","") loop...
2
by: Jason Heyes | last post by:
What is a nice STL statement/s to replace each occurance of the underscore character ('_') with a space character (' ') in a std::string? Thanks.
8
by: Joseph | last post by:
I have a textBox that people writes stories in it. They can use for format. I have Aspell installed on the server, so people can make correction to their text. Sometimes, they forget to add a...
4
by: Vic | last post by:
Hi, With VBA code from MSAccess, how to search for a string in another text file, and replace it with space and then save it under the same name? Your help is greatly appreciated. Rgds
1
by: Jack Wright | last post by:
Dear All, In a multiline field if I enter the following way: Mangesh Anant Kodilkar There is a carriage return after each word. Now when I press save,it loses the CRLF characters. This is not...
3
by: channu | last post by:
Hi I am beginner in c++ coding.I want to read a text file and replace commas and space with tabs. Can any buddy help me out. Thanks Channu
3
by: Paul | last post by:
Hi, My RichTextBox has multiple lines of text. Most of the lines unfortunately end with a space. Is it possible to replace the space and NewLine/Line Feed with just the NewLine/LineFeed? So...
3
by: Pascal | last post by:
bonjour hello I would like to trim a string of all its white spaces so i used myString.trim() but it doesn't work as supposed : unsecable space are remaining in the middle of my string... i...
5
by: Stijn VA | last post by:
Okee, the story goes like this: I have a string that can not contain spaces (It is retrieved from a externat application...) At first they replaced the spaces by '_' so somthing like "ABC DEF"...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.