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.
How do you write 'regular expression' in abbreviated form?
Something else0 (0.0%)
I only ever write it unabbreviated0 (0.0%)
I don't ever write it at all1 (2.9%)
How do you pronounce the g in regexp / regex ?
Hard, like in 'regular' (IPA /ɡ/)22 (61.1%)
Soft, like in 'Reginald' (IPA /dʒ/)12 (33.3%)
Something else1 (2.8%)
I never pronounce these abbreviations1 (2.8%)
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.
The perl manpages use regexp.
It's nicer when both bits of the abbreviation are the same length?
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.
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.
Perl (at least "man perlre") prefers "regexp".
Oh, and a hasty and unscientific Googlefight gave a clear win for "regex", by a convincing 7×106 hits to 6×105.
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".
Oh dear, in the end I couldn't answer the first question because I think I'm completely inconsistent and use both. Sorry :)
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.
I write regex but say regexp, I don't know why! Maybe it has a silent anti-p.
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...
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.
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...
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?
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.
(on balance, but I actually switch between them)
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).
I've head a couple of the UNIX beardies say "Just 'geck it" - similar to 'grep it out of the file', I guess.