
Solved more than an hour ago: http://www.w3schools.com/PHP/func_string_htmlentities.asp No messing around with regex Ward Blondé wrote:
Do you already have a solution for this? I am trying to improve my regex-skills. My solution would be: replace every \s by a  . Maybe not good enough... Or replace every \s\s by \s , loop over it until there are no more \s\s, and then replace every \s  by   .
Ward
Michiel Van Bel wrote:
K, my brain hurts a bit... I have a plain-file(blast-output) that's already been formatted.
Of course, when I just read it in php and send it to html, the layout is totally gone (newlines, spaces, tabs, ...). Anyone has an idea how to easily fix it?
$data = str_replace("\n","<br/>",$data); //fixes newlines
I'd say that replacing every multiple (2+) occurrence of a space should be replaced by the same multiple of (   ), but I can't figure it out exactly (brain is still hurting):
$data = preg_replace("/(\s)(\s+)", ... ,$data); // -->how do you get the count of \s+ ???, so i can replace it by the same count of  's ?
anyone?