WojciechRynczuk / vcdMaker

A tool for converting text log files to the VCD format.
https://vcdmaker.org
MIT License
29 stars 2 forks source link

022 line endings #23

Closed WojciechRynczuk closed 7 years ago

WojciechRynczuk commented 7 years ago

The solution has been tested and it works properly for different EOLs for Windows and Linux. I decided not to indicate in the user manual any specific EOL which is supported as both of them are OK now. A test is missing. As our github repository is stored in the Linux format one would have to prepare a script to manipulate input files on-the-fly.

WojciechRynczuk commented 7 years ago

I wonder why non-capturing group didn't work (?: +.*)? while the capturing group is working ( +.*)?.

endrjux commented 7 years ago

Why do you need any group at all?

endrjux commented 7 years ago

After more thinking: this won't work. We need to match someting e or something e comment, space should not be required after e if no comment is desired. So the regex need to match either e<newline> or e comment<newline>. This is rather hard to do now because newline matching is added in another place.

Please see: https://regex101.com/r/ZWMQsg/2

WojciechRynczuk commented 7 years ago

This is why I used the group. It works. It is matching e<newline> or e comment<newline>. It also fails to match something esomething<newline> as the required space between e and the comment is missing.

So from the lines below: #12 F.Val ecomment #10 C.Val e #12 F.Val ee comment #14 G.Val e More comments

Only lines: #10 C.Val e #14 G.Val e More comments

were matched correctly.

I was just wondering why the non-capturing group failed to work while a capturing group works for the same regex. It seemed to me that the matching behavior shall be the same but obviously it isn't.

endrjux commented 7 years ago

Ok I forgot that we also match line beginning. So it's ok then.