I need a regex. It need not be complex but must cover all bases. Requirements follow:
The file pattern I am forced to follow is such that a file looks like this:
chest/.setup.js chest/**/*-chest.js --choppers something:hello-there/wasup --respite spoc --chow ./chest//test.bootstrap#1 --chow ./chest/server.bootstrap# --blow 200
I must support thousands of other files that have a similar look.
I want to support comments in these files using just one of
My code needs to rip out the comments from the file contents before processing using regex matching.
I haven’t decided which comment syntax to use yet (please no answers that lump both together since only one will be used).
A comment may be at the start of a line (commenting out the whole line) or on the same line at the end (commenting out everything after it).
File paths may be “naive” and contain double slashes like so … /path//to/file/example.js
Also remember that # is a valid filename character and filenames can contain spaces on some operating systems.
My questions are:
(1) What regex is needed to rip out comments if I use the
(2) What regex is needed to rip out comments if I use the
Please feel free to answer (1) or (2) or both individually but not together.
If there are any other considerations that you feel I should take into account, please advise. Answers preferred in ES5 syntax (an annoying restriction).