"Garp" <garp7@no7.blue yonder.co.uk> wrote in message news:<_vpuc.142 4$j_3.13346038@ news-text.cableinet. net>...[color=blue]
> "lawrence" <lkrubner@geoci ties.com> wrote in message
> news:da7e68e8.0 405300907.3c8ea bf7@posting.goo gle.com...[color=green]
> > This reg ex will find me any block of strings 40 or more characters in
> > length without a white space, yes?
> >
> > [^ ]{40}
> >
> >
> > To get it to include tabs and newlines, do I to this?
> >
> > [^ \n\t]{40}[/color]
>
> \s is the whitespace token, if that's easier for you.[/color]
Good, but now my question is how to insert the white space that I
want. If I do this:
$string = ereg_replace ([^\s]{40}, " ", $string);
Then the text gets obliterated and replaced by a white space. That is
not what I want. I simply want to break up long strings (mostly urls)
that threaten to destroy the format of a page. This is especially true
of Internet Explorer, which tends to expand DIV tags to fit the
contents (Netscape lets long urls burts outside the boundries of the
DIV.)
Go look at this page using IE 5 or 6:
You'll see a comment (right now it is the second one down) that looks
like this:
[color=blue][color=green][color=darkred]
>>>>>>>>>>>>> >>[/color][/color][/color]
Misty, I assume you're the one who came up with these interesting
photos of vegetables? Are they from the ARE garden?
http://www.publicdomainsoftware.org/...egetables2.JPG ...read
more[color=blue][color=green][color=darkred]
>>>>>>>>>>>>> >>[/color][/color][/color]
That long url is distorting the whole page. I need to break it up.
I suppose I could hit the whole string with explode() and break them
on the white space and then loop through the array and test each entry
for a length of more than 30 or 40 or so, and then stitch it all back
together with implode, but I was assuming I could do it all more
elegantly with regular expressions. I don't know much about regular
expressions, but if someone does, please let me know.
> "lawrence" <lkrubner@geoci ties.com> wrote in message
> news:da7e68e8.0 405300907.3c8ea bf7@posting.goo gle.com...[color=green]
> > This reg ex will find me any block of strings 40 or more characters in
> > length without a white space, yes?
> >
> > [^ ]{40}
> >
> >
> > To get it to include tabs and newlines, do I to this?
> >
> > [^ \n\t]{40}[/color]
>
> \s is the whitespace token, if that's easier for you.[/color]
Good, but now my question is how to insert the white space that I
want. If I do this:
$string = ereg_replace ([^\s]{40}, " ", $string);
Then the text gets obliterated and replaced by a white space. That is
not what I want. I simply want to break up long strings (mostly urls)
that threaten to destroy the format of a page. This is especially true
of Internet Explorer, which tends to expand DIV tags to fit the
contents (Netscape lets long urls burts outside the boundries of the
DIV.)
Go look at this page using IE 5 or 6:
You'll see a comment (right now it is the second one down) that looks
like this:
[color=blue][color=green][color=darkred]
>>>>>>>>>>>>> >>[/color][/color][/color]
Misty, I assume you're the one who came up with these interesting
photos of vegetables? Are they from the ARE garden?
http://www.publicdomainsoftware.org/...egetables2.JPG ...read
more[color=blue][color=green][color=darkred]
>>>>>>>>>>>>> >>[/color][/color][/color]
That long url is distorting the whole page. I need to break it up.
I suppose I could hit the whole string with explode() and break them
on the white space and then loop through the array and test each entry
for a length of more than 30 or 40 or so, and then stitch it all back
together with implode, but I was assuming I could do it all more
elegantly with regular expressions. I don't know much about regular
expressions, but if someone does, please let me know.
Comment