When not to use Regex in C# (or Java, C++, etc.)

后端 未结 7 1239
囚心锁ツ
囚心锁ツ 2020-11-28 13:12

It is clear that there are lots of problems that look like a simple regex expression will solve, but which prove to be very hard to solve with regex.

<
7条回答
  •  野性不改
    2020-11-28 13:57

    I'm a beginner when it comes to regex, but IMHO it is worthwhile to spend some time learning basic regex, you'll realise that many, many problems you've solved differently could (and maybe should) be solved using regex.

    For a particular problem, try to find a solution at a site like regexlib, and see if you can understand the solution.

    As indicated above, regex might not be sufficient to solve a specific problem, but browsing a browsing a site like regexlib will certainly tell you if regex is the right solution to your problem.

提交回复
热议问题