Regular language [entries|reading|network|archive]
simont

[ userinfo | dreamwidth userinfo ]
[ archive | journal archive ]

Tue 2016-06-21 08:47
Regular language

I noticed yesterday after writing a comment in some code that one of my writing habits had changed, without me really noticing. So I thought I'd see what other people's opinions were.

Poll #17528 A regular holy war
Open to: Registered Users, detailed results viewable to: All, participants: 36


How do you write 'regular expression' in abbreviated form?

View Answers

regexp
9 (26.5%)

regex
24 (70.6%)

Something else
0 (0.0%)

I only ever write it unabbreviated
0 (0.0%)

I don't ever write it at all
1 (2.9%)

How do you pronounce the g in regexp / regex ?

View Answers

Hard, like in 'regular' (IPA /ɡ/)
22 (61.1%)

Soft, like in 'Reginald' (IPA /dʒ/)
12 (33.3%)

Something else
1 (2.8%)

I never pronounce these abbreviations
1 (2.8%)

[xpost |http://simont.livejournal.com/243797.html]

LinkReply
[personal profile] simontTue 2016-06-21 07:51

I always used to be a 'regexp' person, but prolonged exposure to 'regex' seems to have recently built up enough activation energy to switch me over.

Now I'm on the other side, I find myself wondering what the point of the p was in the first place – 'regex' is adequately unambiguous and takes fewer characters, so what's not to like? But I can't remember why I adopted the p spelling myself. I'd be quite interested to know whether there are any centralised sources (particular textbooks, library APIs, influential articles or some such) that might be responsible for popularising one or the other.

Link Reply to this | Thread
[personal profile] stephdairyTue 2016-06-21 08:06

The perl manpages use regexp.

Link Reply to this | Parent
[personal profile] atreicTue 2016-06-21 08:27

It's nicer when both bits of the abbreviation are the same length?

Link Reply to this | Parent | Thread
[personal profile] simontTue 2016-06-21 08:31

I hadn't thought of that, though the thought has just occurred to me that 'exp' by itself, shorn of the 'reg' prefix, makes a more comprehensible abbreviation of 'expression' than 'ex' does.

Link Reply to this | Parent
[personal profile] jackTue 2016-06-21 09:45

I was thinking that. I think I use regexp occasionally but regex more. I *think* I learned regexp first, but it eroded quickly, but I'm not sure, it could have been the other way round.

Link Reply to this | Parent
[personal profile] ptc24Tue 2016-06-21 10:57

I know that python, Java and C# prefer "regex", JavaScript prefers "regexp", R is inconsistent.

Link Reply to this | Parent | Thread
[personal profile] damerellTue 2016-06-21 17:39

Perl (at least "man perlre") prefers "regexp".

Link Reply to this | Parent
[personal profile] simontTue 2016-06-21 08:09

Oh, and a hasty and unscientific Googlefight gave a clear win for "regex", by a convincing 7×106 hits to 6×105.

Link Reply to this
[personal profile] ptc24Tue 2016-06-21 08:10

For the first question - I think "either, inconsistently, probably depending on which form I've encountered in context".

I think I've been known to use "rexp" as a variable name (partly to avoid a clash with "re" - longer names tend to be "fooBarRe" or "foobarre" depending on language), and I don't think I've been known to use "rex".

Link Reply to this
[identity profile] lnr.livejournal.comTue 2016-06-21 09:04

Oh dear, in the end I couldn't answer the first question because I think I'm completely inconsistent and use both. Sorry :)

Link Reply to this | Thread
[personal profile] simontTue 2016-06-21 09:07

Gah! I knew there'd be an obviously useful poll option I left out. You're quite right, of course, I should have made that one of the radio buttons. D'oh.

Link Reply to this | Parent
[personal profile] cebTue 2016-06-21 11:17

I write regex but say regexp, I don't know why! Maybe it has a silent anti-p.

Link Reply to this | Parent
[personal profile] emperorTue 2016-06-21 09:37

I'm pretty sure I use both regex and regexp, but the latter more frequently. And both more than reggae, which this infernal mac tried to correct them to...

Link Reply to this
[personal profile] gerald_duckTue 2016-06-21 14:37

For me, the surest argument in favour of "regex" over "regexp" is that it's an appreviation of "reg-u-lar ex-press-ion" and the latter pointlessly includes a part-syllable.

Link Reply to this
[personal profile] pvaneyndWed 2016-06-22 07:03
IPA not so standard?

I think you would say I use soft g, as I'm Flemish we have a tendency to use soft all the time, but I cannot hear the difference between /ɡ/ and /dʒ/ in your examples using google translate to hear them didn't help much.

Oh and I pronounce it as "are you certain using this is not a mistake?" as when I need to discuss them people are often ... misguided ;).

The sound samples at https://nl.wikipedia.org/wiki/Stemhebbende_postalveolaire_affricaat and https://nl.wikipedia.org/wiki/Stemhebbende_velaire_plosief were helpful, but strangely enough the samples at https://en.wikipedia.org/wiki/Voiced_palato-alveolar_affricate and https://en.wikipedia.org/wiki/Voiced_velar_stop were confusing.

I thought that IPA should be a sort of standard, so how come I needed to use the Dutch version? Interesting but confusing...

Link Reply to this | Thread
[personal profile] simontWed 2016-06-22 10:21

As I understand IPA, it's supposed to be 'standard' in the sense that it describes sounds by the physical method of making them with human vocal apparatus, rather than by reference to any particular language or dialect. That doesn't stop any given sound still being potentially confusing to speakers of a language that it doesn't fit naturally into!

Listening to the sound samples at those links, they seem fine to me – both pairs are clearly distinguishing what I'd think of as the 'soft' and 'hard' sounds made by 'g' in English. (It sounds as if the two for /dʒ/ are actually the same sample.) I agree that the /ɡ/ sample on the Dutch page is a bit clearer in audio quality than the one on the English page, but the latter still seemed clear enough to me.

Oh and I pronounce it as "are you certain using this is not a mistake?" as when I need to discuss them people are often ... misguided ;).

I'm interested to know what you mean by that. Is this an engineering complaint that people use regular expressions when another tool would be better for the job, or a theoretical complaint that people often say 'regular expression' to describe something that doesn't satisfy the technical definition of a regular expression at all (e.g. Perl supporting back-references), or something else entirely?

Link Reply to this | Parent | Thread
[personal profile] pvaneyndWed 2016-06-22 10:47

At my work we often have to extract data from outputs our customer send us. More or less mutilated.

People often try to use regular expressions to parse this output which actually has a grammar. Instead of using a parsing tool to understand the grammar they write 'quick' regexp patterns which gets the data they are interested in.

Then they discover that another version give the data in a slightly different way. Another platform again slightly different. In the end the 'simple' regexp becomes a tangled mess of linenoise. For bonus points this pattern often has to ignore line endings and will be unbound, then applied on multi-megabyte files, in a loop.

Going for the simpler parser would have been much easier in the long run. Or at least a sane middle way like textfsm.

Link Reply to this | Parent
[personal profile] kaberettWed 2016-06-22 09:10

(on balance, but I actually switch between them)

Link Reply to this
[personal profile] fluffymormegilThu 2016-06-23 18:30

At one point I said regexp, but the phonotactical horribleness of /ksp/ as a word-final consonant cluster appears to have resulted in the /p/ getting abraded away in my brain and my typing habit followed (because shorter).

Link Reply to this
[personal profile] hairyearsSat 2016-06-25 17:21

I've head a couple of the UNIX beardies say "Just 'geck it" - similar to 'grep it out of the file', I guess.

Link Reply to this
navigation
[ go | Previous Entry | Next Entry ]
[ add | to Memories ]