Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re^2: No \G for s///g ? (oops)

by demerphq (Chancellor)
on Mar 22, 2003 at 12:52 UTC ( [id://245126]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://245126]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-26 04:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found