Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Ed Morton Newsgroups: comp.unix.shell,comp.unix.programmer,comp.lang.misc Subject: Re: Command Languages Versus Programming Languages Date: Wed, 20 Nov 2024 05:46:49 -0600 Organization: A noiseless patient Spider Lines: 33 Message-ID: References: <87edbtz43p.fsf@tudado.org> <0d2cnVzOmbD6f4z7nZ2dnZfqnPudnZ2d@brightview.co.uk> <87a5fdj7f2.fsf@doppelsaurus.mobileactivedefense.com> <86frnmmxp7.fsf@red.stonehenge.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 20 Nov 2024 12:46:51 +0100 (CET) Injection-Info: dont-email.me; posting-host="61cdf8b9945abf027c8ade10fe7b6534"; logging-data="91704"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18fctxzwEvHsVPKub4y0N9J" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:+OvgIN4RS7QBnZPMuNHt5aBYDJg= Content-Language: en-US X-Antivirus-Status: Clean X-Antivirus: Avast (VPS 241120-0, 11/19/2024), Outbound message In-Reply-To: Bytes: 3092 On 11/20/2024 2:21 AM, Muttley@DastartdlyHQ.org wrote: > On Tue, 19 Nov 2024 18:43:48 -0800 > merlyn@stonehenge.com (Randal L. Schwartz) boring babbled: >>>>>>> "Lawrence" == Lawrence D'Oliveiro writes: >> >> Lawrence> Perl was the language that made regular expressions >> Lawrence> sexy. Because it made them easy to use. >> >> I'm often reminded of this as I've been coding very little in Perl these >> days, and a lot more in languages like Dart, where the regex feels like >> a clumsy bolt-on rather than a proper first-class citizen. > > Regex itself is clumsy beyond simple search and replace patterns. A lot of > stuff I've seen done in regex would have better done procedurally at the > expense of slightly more code but a LOT more readability. Definitely. The most relevant statement about regexps is this: > Some people, when confronted with a problem, think "I know, I'll use > regular expressions." Now they have two problems. attributed to Jamie Zawinski, see https://blog.codinghorror.com/regular-expressions-now-you-have-two-problems/. Obviously regexps are very useful and commonplace but if you find you have to use some online site or other tools to help you write/understand one or just generally need more than a couple of minutes to write/understand it then it's time to back off and figure out a better way to write your code for the sake of whoever has to read it 6 months later (and usually for robustness too as it's hard to be sure all rainy day cases are handled correctly in a lengthy and/or complicated regexp). Ed.