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

+65

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

Ace

18 Answers

New Answer

+89

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

+25

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!

+20

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 😅

+15

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.

+14

[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

+13

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

+8

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

+5

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.

+4

+4

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.

+2

i m also confused?

+1

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.

+1

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

0

Regex is cool😂

0

-1

I am highly confused with this app and need help

-3

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

-5

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