Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^2: Stuck in komplexer regex, at least for me

by ultibuzz (Monk)
on Mar 26, 2007 at 16:09 UTC ( #606607=note: print w/replies, xml ) Need Help??

in reply to Re: Stuck in komplexer regex, at least for me
in thread Stuck in komplexer regex, at least for me

sorry forgot to say that the rule first 0 no touch only applies when its after position 3
kd ultibuzz

  • Comment on Re^2: Stuck in komplexer regex, at least for me

Replies are listed 'Best First'.
Re^3: Stuck in komplexer regex, at least for me
by johngg (Abbot) on Mar 26, 2007 at 16:25 UTC
    I'm afraid things are becoming more confusing rather than less. From the first four examples in your desired output I can guess at these rules:

    Look for a sequence of two or more zeros

    If the sequence found starts in position 1, 2 or 3, (counting from 1 but note that Perl usually counts from 0), replace all the zeros by nothing

    If the sequence starts from position 4 or greater, replace all but one of the zeros with nothing

    I can't see how the fifth example fits into anything you have described.



Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://606607]
[perldigious]: Ah, thanks choroba, that sort of thing was precisely what I was wondering when I asked.
[perldigious]: I didn't want to tie up memory unecessarily basically, I wanted to "delete" it specifically to free it up, and wasn't sure I was even accomplishing that.
[stevieb]: perldigious You should start by writing some unit tests. That'll ensure current functionality doesn't break with changes.
[choroba]: unit tests++
[choroba]: The only problem you can't solve by adding more tests is the problem of having too many tests.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (7)
As of 2017-07-21 20:00 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (335 votes). Check out past polls.