Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^3: is (?: ... ) capturing

by ysth (Canon)
on Sep 07, 2009 at 07:47 UTC ( #793897=note: print w/ replies, xml ) Need Help??


in reply to Re^2: is (?: ... ) capturing
in thread is (?: ... ) capturing

Yes, because lookbehind has to be fixed-width, you'd need to do s/(\s+)\w/${1}_/g.
--
A math joke: r = | |csc(θ)|+|sec(θ)|-||csc(θ)|-|sec(θ)|| |
Online Fortune Cookie Search
Office Space merchandise

Replies are listed 'Best First'.
Re^4: is (?: ... ) capturing
by ikegami (Pope) on Sep 07, 2009 at 09:30 UTC
    s/(\s+)\w/${1}_/g
    simplifies to
    s/(\s)\w/${1}_/g
    Now you can use a zero-width lookbehind to get the speed boost of avoiding captures.
    s/(?<=\s)\w/_/g
    Or in 5.10+:
    s/\s\K\w/_/g
Re^4: is (?: ... ) capturing
by jeanluca (Deacon) on Sep 07, 2009 at 07:51 UTC
    ok, thnx again!!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2016-06-28 09:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (355 votes). Check out past polls.