On Wednesday, January 14, 2004, at 10:39 AM, Dave Cragg wrote:



Just out of interest, is "(?>x)*" a valid regular expression? If so, what does it do?

Yes. It is a non-backtracking, non-capturing group. Non-backtracking has many uses, but I use it especially to keep match failures from taking a very long time.


This particular trivial example can be done other ways, of course. In trying to narrow down the bug I reduced the problem to the trivial.

Other non-capturing groups have the same or similar problem. The most common is simple clustering: "(?:x)" Assertions also do not capture.

I discovered this when trying to make a regex to test whether text is field safe, that is, whether it has certain control characters or long lines. (That was before I realized that there is also a formatedWidth limit on lines, too.)

Dar Scott

_______________________________________________
use-revolution mailing list
[EMAIL PROTECTED]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to