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.
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);
?>
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.