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

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

Replies are listed 'Best First'.
Re^5: is (?: ... ) capturing
by ysth (Canon) on Sep 07, 2009 at 17:18 UTC