1 # Let's have some fun -- try to match a C comment. 2 # first the obvious, which looks okay at first glance... 3 /\*.*\*/ - /*x*/ /*x*/ 4 # but... 5 /\*.*\*/ - /*x*/y/*z*/ /*x*/y/*z*/ 6 # okay, we must not match */ inside; try to do that... 7 /\*([^*]|\*[^/])*\*/ - /*x*/ /*x*/ 8 /\*([^*]|\*[^/])*\*/ - /*x*/y/*z*/ /*x*/ 9 # but... 10 /\*([^*]|\*[^/])*\*/ - /*x**/y/*z*/ /*x**/y/*z*/ 11 # and a still fancier version, which does it right (I think)... 12 /\*([^*]|\*+[^*/])*\*+/ - /*x*/ /*x*/ 13 /\*([^*]|\*+[^*/])*\*+/ - /*x*/y/*z*/ /*x*/ 14 /\*([^*]|\*+[^*/])*\*+/ - /*x**/y/*z*/ /*x**/ 15 /\*([^*]|\*+[^*/])*\*+/ - /*x****/y/*z*/ /*x****/ 16 /\*([^*]|\*+[^*/])*\*+/ - /*x**x*/y/*z*/ /*x**x*/ 17 /\*([^*]|\*+[^*/])*\*+/ - /*x***x/y/*z*/ /*x***x/y/*z*/ 18