I set a scanner's delimiter like:
scanner.useDelimiter("(\\s*?)(#.*?\n)(\\s*?)");
The goal is to ignore comments of the form
#comment \n
Thus:
Hello#inline comment
world.
becomes:
Hello
world.
By setting the delimiter as I did, I would think:
Hello#inline comment world.
would become:
[Hello]
and:
Hello#inline comment\n world.
would become
[Hello, world.]