
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? -- ================================================================== Michiel Van Bel PhD student Tel:+32 (0)9 331 36 95 fax:+32 (0)9 3313809 VIB Department of Plant Systems Biology, Ghent University Technologiepark 927, 9052 Gent, BELGIUM mibel@psb.ugent.be http://www.psb.ugent.be ==================================================================

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?
-- ================================================================== Ward Blondé wablo@psb.ugent.be PhD student Tel:+32 (0)9 331 38 24 fax:+32 (0)9 3313809 VIB Department of Plant Systems Biology, Ghent University Technologiepark 927, 9052 Gent, BELGIUM http://www.psb.ugent.be/cbd/people_ward_blonde.php ==================================================================

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?

Well,... not really. That function doesn't really do what i need it to do :( I'm working on it though. substituting \s with works a bit, but still breaks the layout a bit. I might try ward his second suggestion (although it doesn't really seem fast). Michiel Thomas Abeel wrote:
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?
_______________________________________________ Binari Intellectuals Need And Require Insanity https://maillist.psb.ugent.be/mailman/listinfo/binari
-- ================================================================== Michiel Van Bel PhD student Tel:+32 (0)9 331 36 95 fax:+32 (0)9 3313809 VIB Department of Plant Systems Biology, Ghent University Technologiepark 927, 9052 Gent, BELGIUM mibel@psb.ugent.be http://www.psb.ugent.be ==================================================================

normally if you do: s/\s/ /g (in PERL) he will replace every occurence of a \s with a   in the whole string L. Michiel Van Bel wrote:
Well,... not really. That function doesn't really do what i need it to do :(
I'm working on it though. substituting \s with works a bit, but still breaks the layout a bit. I might try ward his second suggestion (although it doesn't really seem fast).
Michiel
Thomas Abeel wrote:
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?
_______________________________________________ Binari Intellectuals Need And Require Insanity https://maillist.psb.ugent.be/mailman/listinfo/binari
-- ============================================================== Lieven Sterck, PhD Tel:+32 (0)9 3313821 Fax:+32 (0)9 3313809 VIB Department of Plant Systems Biology, UGent Bioinformatics and Evolutionary Genomics Division Technologiepark 927, B-9052 Gent, Belgium Email: lieven.sterck@psb.ugent.be Website: http://bioinformatics.psb.ugent.be ============================================================== "Facts are meaningless. You could use facts to prove anything that's even remotely true!" H. Simpson
participants (4)
-
lieven sterck
-
Michiel Van Bel
-
Thomas Abeel
-
Ward Blondé