Why doesn't C have regular expressions when they predate the language? | Sololearn: Learn to code for FREE!


Why doesn't C have regular expressions when they predate the language?

The first RegExs were used in the 1950s, C came along in 1970. So I am just curious why the early designs of the C language excluded them. Surely they come in handy for searching files and other areas?

3/30/2018 10:23:31 PM


18 Answers

New Answer


Because Unix had various tools you ran from your C program so support wasn't needed within the language.


Pure guess: C was made as small as possible (why it's so modular). I don't think design choice so much as lack thereof. One thing I like about C has been lack of feature creep (compared to C++ and others). The design principle was probably KISS. I mean there's no built-in string but implementing one is simple. So, yeah, my money's on simply wasn't necessary nor was it a serious "game-changer" in terms of use case. Sidenote: Holy schit, regex is older than my mother!


For a moment I was going to say that C had <regex.h>, but I realized that it is part of the POSIX regular expression library looking on internet 😅


John Wells and the others make great points. I'd also add that text processing wasn't as essential before the internet! Text processing and text-based data has taken off exponentially. PHP is a web-based language so regular expressions are part of the language.


[meta] Here are some short bios in regex history (e.g., Henry Spencer, the first to release a regex library for importing (1986), Ken Thompson for including it in "ed", ...etc) http://blog.stevenlevithan.com/archives/regex-legends


And the regular expressions from UNIX are developed with C and are very fast.


Read about Bell Labs... for insight into B to C languages https://www.bell-labs.com/usr/dmr/www/bintro.html


BB_CODER_Girl I sorry you are confused. However, spamming this question is NOT the answer. Please delete your post. I'll tag you where we can talk.



Sadaam Omer Ali you have literally copied verbatim the answer _originally_ posted by John Wells . Berne Convention says that's copyright infringement, I say it's just being a doos. I'm not going to report you this time, but I suggest you don't do it again. Maybe say sorry, too.


i m also confused?


I suppose John Wells is wrong. C was created to replace asm in development of operation systems and other. So, it is very powerfull , but it is not even high level language. RegExp's are more suitable for script coding, not for system.


I think that because it's nearby to the lower level languages


Regex is cool😂



I am highly confused with this app and need help


at that time c was newbie... a few professors were programmer of C "see"...similar to a Chinese space station... fall back to earth ... & nowadays black hole...story


Because Unix had various tools you ran from your c program so support wasn’t needed within the language. Bye