Beefy Boxes and Bandwidth Generously Provided by pair Networks RobOMonk
more useful options
 
PerlMonks  

Re: Creating a fill-in regexp

by shenme (Priest)
on Sep 24, 2003 at 14:50 UTC ( [id://293967]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Creating a fill-in regexp

Use a 'substitute' ;-)
$s1 = '0000010000000100000100001'; $s1 =~ s/1(0+)1/'1'x((length($1)+2))/eg;
Output
 0000011111111100000111111

Replies are listed 'Best First'.
Re: Re: Creating a fill-in regexp
by jpfarmer (Pilgrim) on Sep 24, 2003 at 15:15 UTC
    It never occured to me that I could replace with a variable-length string. Oops. I feel pretty dumb now.

    Thanks for your help!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://293967]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.