in reply to Re: Re: Re: Re: Do nothing? or Do something important in a very obscure way?
in thread Do nothing? or Do something important in a very obscure way?

Actually, what x{0} says is "succeed if there are zero x'es here". And that's always true, because we can always match none of something, even in an empty string. So basically, x{0} is a NOP, and so is x??: and x*?:.

Makeshifts last the longest.

  • Comment on Re^5: Do nothing? or Do something important in a very obscure way?

Replies are listed 'Best First'.
Re: Re^5: Do nothing? or Do something important in a very obscure way?
by BrowserUk (Patriarch) on Aug 23, 2002 at 19:23 UTC

    Actually, that's exactly what I thought it meant, hence the "Do nothing?" in the title.

    I remember the days when I used to be obliged to put blocks of NOP's into my assembler subroutines (we used a ratio of 1::20 active instructions) to allow space for remedial patching of the executable, but I couldn't see why you would add them to a regex!


    What's this about a "crooked mitre"? I'm good at woodwork!
      There is no reason to be adding them to a regex. It is simply due to the way the double colon works that postfixing it to a nongreedy match turns the match into a NOP, which is what TheDamian was mentioning in the Exegesis.

      Makeshifts last the longest.