EgorKulikov / idea-chelper

Automatically exported from code.google.com/p/idea-chelper
112 stars 59 forks source link

Regex Support patch #54

Closed blue-atom closed 6 years ago

blue-atom commented 6 years ago

Recently after some changes on codeforces, chelper stopped working (issue #52) due to extra added attributes. Which lead to changes in CodeforcesParser.java. commit #53 by @petrmitrichev fixed that issue but that solution is very specific for this problem. In future also due to some external changes will break the code and adding separate methods for fixing each issue is not feasible.

Use of Regular Expressions for matching can make code more flexible against future external changes. It will be very easy to fix the issue as regex (Regular Expression) is more general purpose than custom function. The regex will also facilitate complex pattern matching and dynamic pattern matching, in which contents of the pattern is not fixed.

In this branch, I have added advanceRegex() method to StringParser.java , which adds support to use the regular expression as samples. And to fix issue #52 and to demonstrate the use of Regex I have also modified CodeforcesParser.java, From the code, it is clear that matching issues can be fixed easily and you don't need to add extra methods inside each parser.