Hello,

i need aregex code that can add SPACE to evry line in text,
thanks for helpers :)

Where in the line of text do you need the space?

Can you provide some example text.

the text is post
lets say its:

Hey hey hey
http://blalsadla.com
sadasd

add space to end of evry line

My Regex does fail me, but I think something along the lines of this should work.

$var = "One line\nTwo Line\nThree Line\n";
$var = preg_replace('/\b$/m', ' ', $var);
echo nl2br($var); //Convert newlines to br for viewing purposes.
<?php
$text = "one\ntwo\nthree\nfour";
echo preg_replace("/\\n/m"," \n",$text);
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.