What’s faster: Regex or string operations? [closed]

It depends

Although string manipulation will usually be somewhat faster, the actual performance heavily depends on a number of factors, including:

  • How many times you parse the regex
  • How cleverly you write your string code
  • Whether the regex is precompiled

As the regex gets more complicated, it will take much more effort and complexity to write equivlent string manipulation code that performs well.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)