Opinions vary. It would be a dull world if we all thought the same way.
Likewise with standards. As the saying goes: “Standards are great. There are so many to choose from…”
I’m ok with that. I usually want to spare some CPU cycles while doing some good practices. But coding style can vary.
Const Pattern As String = _
"(?U)" + _ // Ungreedy
"/\*" + _ // Opening delimiter
"[\s\S]*" + _ // Zero or more of anything
"\*/" // Closing delimiter
I would be happier with this. At least the terms line up with out the plusses getting in the way.
The idea was to remove as much possible that + _ noise between the content and comment, but as I already said, I’m ok with your style, it’s readable.
Still prefer looking at this
Than this
But ok.
I guess I pay more attention to the left hand side of the line and you the right… I find the + extremely distracting. Looking over to the right doesn’t bother me as long as the comments line up. The search elements lining up on the left and the comments on the right would be pretty vital to me. I can ignore the mud in the middle. I find that the colour blocks help with that, but for me the alignment would be critical.
Yes, all them start and end in the same line. But we have found the solution.
Thank you.
In addition, even compiled Regex can be quite slow on hot paths relative to alternatives. In one text processing application I got about 20% overall performance improvement by pre-testing before applying regex. For example if there was a complex Regex starting with ^BLAH then I would first see if the string to be tested starts with “BLAH” and if so THEN apply the Regex. The small overhead of the StartsWith() test avoided so many Regex calls that it was well worth it. Of course the use case was that a relatively small number of strings would be expected to match each Regex pattern.
When you think of it, Regex expressions can do a TON of work and must expand out to many, many lines of code at times under the hood.