in reply to 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?
'x??' means that it notes that it has a decision, and first tries to match no x's. If it fails then it will backtrack, reconsider that decision, and try to match one x then go forward. If that fails, then you fail.
'x*?' is similar. It notes that it has a decision, and first tries to match no x's. If it fails then it will backtrack, try to match one x, and then try to make the same decision over again. (That is the difference between the * and the ?. The ? will try to match at most once then proceed. The * returns to trying to match the preceeding group, and therefore can match there an unlimited number of times.)
If that didn't make sense then pick up Mastering Regular Expressions by Friedl. He explains it better.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Do nothing? or Do something important in a very obscure way?
by BrowserUk (Patriarch) on Aug 23, 2002 at 11:03 UTC |