# Tag Info

6

When you're comparing against 8 different patterns, and then simply removing - for 7 of those validations, why not just remove - initially, and then validate against the only remaining pattern. Another thing to note is, in the patterns, at the end; you have a character set: [\d|\X]. This actually will match one of: a digit literal | literal X characters (...

5

General issues to the whole concept: There is a reason why ini file format is considered deprecated by Microsoft. File formats like json and xml have tree-like structure making them a lot more flexible that ini file format that has only single-depth sections. Suppose you want a class to obtain a value from the configuration file. Okay, that's simple just ...

5

hjpotter92 starts with the right idea: Unify and simplify. You just should go much further. Also, don't give up if the last digit is X, that's a perfectly fine digit for your code. You aren't (or shouldn't) be interested in all the dashes, so ignore them. Could you even know that you have all the used patterns? Take a closer look at wikipedia on ISBN10, and ...

4

Code Style Remember to follow PEP 8 where you can. In particular, you should use snake_case rather than camelCase. Making your Intentions Clear Be sure to use comments to explain why your steps are needed rather than just what your code does: lenText -= 1 # reduce lenText by 1 It is reasonably clear what your code is doing, but you could comment to explain ...

4

I would tackle this problem by not adding the last regex to the list but to have this as a separate regex. Using a little "trick" by using Enumerable.Range() you can replace the for with a linq expression like so if (Enumerable.Range(0, 4).Any(i => !regexList[i].IsMatch(dataFile[i]))) { return false; } After the loop you have this line var ...

2

Disclaimer: Not a Code Reviewer Your solution looks fine; Overall, we would want to stay away from regular expressions in solving algorithm problems – especially easy LeetCode questions are to measure our implementation skills; C# has two simple functions that would do the job of (\W|_): public class Solution { public bool IsPalindrome(string s) { ...

2

Disclaimer: Not a Code Reviewer Just looking into the regular expressions here! Not sure exactly what we are doing. My guess is that: We would probably want: regexList.Add(new Regex("^(?:\\d,\\d )*(?:\\d,\\d)$")); instead of regexList.Add(new Regex("^(\\d,\\d )*(\\d,\\d)$")); and we don't want the {1}: regexList.Add(new ...

Only top voted, non community-wiki answers of a minimum length are eligible