String manipulation vs Regexps

后端 未结 6 508
轮回少年
轮回少年 2021-01-18 13:45

We are often told that Regexps are slow and should be avoided whenever possible.

However, taking into account the overhead of doing some string manipulation oneself (

6条回答
  •  感情败类
    2021-01-18 14:04

    Regexes aren't slow. But implementation can be slow, mostly because it is often interpreted and build again each time when they are used. But good regexp library allows you to use compiled versions. They are pretty fast.

提交回复
热议问题