Computer science has automata theory with lessons on regular expressions and FSM. How are these different from regex engines used in programming such as C++, Perl, PHP etc.?

I would like to know some differences i.e. stuff that can only be done with regexps in programming but cannot be done in formal regexps in computer science.

I heard there are a lot are differences but what are some major ones? Let's take Perl Compatible Regular Expressions (PCRE) or Boost.Regex for comparsion.

  • $\begingroup$ I can elaborate my answer further, but most major differences boil down to a simple fact that in theoretical CS regular expressions aren't designed to find and/or replace substrings in a longer string. They are used to check "whole matches", i.e., whether a given string belongs to a given language. This makes the whole topic of lazy matching, groups or backreferences irrelevant. Lazy/eager matching is especially important here, since they require different types of automata. $\endgroup$ Jan 12, 2019 at 14:19
  • $\begingroup$ @rg_software: Sure, you can post the differences as a list in answer. Thanks. $\endgroup$
    – cpx
    Jan 12, 2019 at 14:32
  • $\begingroup$ @rg_software, I recommend that you write an answer about finding or replacing substrings as well as lazy and eager matching to that question. $\endgroup$
    – John L.
    Jan 12, 2019 at 17:29