in reply to Re^2: No \G for s///g ? (oops)
in thread No \G for s///g ?

Try setting $len to 5. You'll see that the 'tight' version fails to wrap correctly under certain circumstances like this

Wrapping: @[0;7mCoruscate@[0m says this is a test of the line wrapping code Tight code1: @[0;7mCoruscate@[0m says this is a test of the line wrapping code Tight code: @[0;7mCorus cate@[0m says this is a test of the line wrapp ing code

which suggested to me that the regexes be executed in opposite order

Wrapping: @[0;7mCoruscate@[0m says this is a test of the line wrapping code Tight code1: @[0;7mCorus cate@[0m says this is a test of the line wrapp ing code Tight code: @[0;7mCorus cate@[0m says this is a test of the line wrapp ing code

which seems to do the trick. I believe the first regex gets stymied by lines that have to be split many times at a space, as well as being split many times inside a word.


---
demerphq


Replies are listed 'Best First'.
Re^4: No \G for s///g ? (oops)
by tye (Sage) on Mar 22, 2003 at 19:59 UTC

    Good catch. Thanks.

                    - tye