Daily battles won in the war on regular expressions - Vol. 1

I'm not too hot when it comes to regular expressions, so I've decided to document every battle won, however big or small, in my war on regular expressions.

The problem

Parse the following snippet of Stylus and remove all the comments, while ignoring all the glob patterns in the @require statements, to fix this issue with Stylint:

/* 'aa/' */


/* someone said 'hello' */

/* "hello"*/




// let's try a single quote here "test"




  'test ' */

/** @require 'aa/*' */

  content ''/* test */

@require 'aaa/*'

@require 'bbb/*' /* test */

@require 'ccc/*'

@require 'ccc/* ab */' /* test */

@require 'ddd/*' /*test  '*/
@require "ddd/*" /*test  '*/

@require 'eee/*'
// test again

@require 'fff/*'

@require 'ggg/*'

@require 'hhh/*'

@require 'iii/*'

@require 'jjj/*' /* test */

@require 'kk/**/*'

The other-worldly solution from Ross Patton


Check out why it works, and what it matches