Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

2
  • 1
    Standard ed, grep, and sed all uses basic regular expressions by default. Alterations are not part of the this type of regular expressions. grep and sed can often be made to use extended regular expressions as a non-standard extension, which includes alterations. GNU grep also supports Perl-compatible regular expressions, as a further extension to the POSIX specification for this utility. This is not an answer as it says nothing about why alterations were not part of the basic regular expression syntax (which is what I believe the question is really about). Commented Dec 8, 2020 at 20:21
  • I suspect that support for alternation requires either a relatively large amount of memory or a large amount of backtracking (which is slow) in common cases, whereas support for alternation only requires a large amount of backtracking in unusual cases. But that's from a very dim memory of regexp compilation techniques (and I don't even know what techniques were known in Thompson's time), not from research into Thompson's motivations. Commented Dec 8, 2020 at 21:43