When is it best to use Regular Expressions over basic string splitting / substring'ing?

前端 未结 7 1612
旧巷少年郎
旧巷少年郎 2020-12-01 12:46

It seems that the choice to use string parsing vs. regular expressions comes up on a regular basis for me anytime a situation arises that I need part of a string, informatio

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-01 12:58

    I would think the easiest way to know when to use regular expressions and when not to, is when your string search requires an IF/THEN statement or anything resembling this or that logic, then you need something better than a simple string comparison which is where regex shines.

提交回复
热议问题