Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I want to know what is more standard way to call regular expression in short way. I have seen both, regex and regexp.

Google says regex has almost 2 as much hits that regexp, but it depends on way I search it (when I add "regular expression" after the word, "regex" becomes "regex regular expression", the result is differend). And on stackexchange there is regex tag. :)

What is more proper way to shorten it?

Perhaps it does not matter. :) But thanks for answer.

share|improve this question

closed as not constructive by Mark Trapp Aug 20 '11 at 18:39

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

    
How to shorten the word "regular expressions" isn't really a constructive question that's going to have a correct answer or provide anything more than a poll of people's preferences. –  user8 Aug 20 '11 at 18:41
    
@Mark -- I do not see why this question was closed as "not meeting the guidelines". I can tick off the guidelines, and IMO it meets most of them. For instance, it is asked in an impartial tone, it invites discussion of why (as seen in some of the excellent answers), it invites sharing of experiences, and it is not merely "mindless fun". –  Jay Elston Aug 20 '11 at 21:56
    
@Jay I encourage you to take a look at the FAQ, specifically under the section on what not to ask and particularly the part where it says to avoid asking questions where every answer is equally valid and there's no actual problem to be solved. If you have any additional concerns or questions, feel free to ask about it on our meta discussion site. –  user8 Aug 20 '11 at 22:03
    
Regexp is kind of old, IMHO. –  muntoo Sep 13 '11 at 7:00
add comment

7 Answers

There's no right or wrong abbreviation here. It'll mostly be influenced by what APIs you're working with:

It's Regex!

It's Regexp!

It's something else entirely!

The fact that Jeffrey Friedl, author of the excellent Mastering Regular Expressions, lives at regex.info is good enough for me: I tend to call them regexes. But I keep this close at hand just in case I change my mind later...

s/\bregex\b/$&p/gi;
share|improve this answer
    
It's Rexexp in perl. Proof: Execute this one-liner: perl -le 'print ref(qr/re/)'. Or maybe its regex? "regex" wins out over "regexp" by a wide margin in man perlre. –  David Hammen Aug 20 '11 at 16:37
    
It's regex, FTW! –  muntoo Sep 13 '11 at 6:59
    
This is a minor nit, but regular expressions aren't called "preg" in PHP. preg is the prefix for one set of regex functions that use the PCRE engine. –  MattBelanger Sep 13 '11 at 10:46
    
@MattBelanger And they're not "called" // in Perl either. :) It was a general point about the various abbreviations or other conventions used between languages. –  Mark Whitaker Sep 13 '11 at 12:52
1  
@Mark Whitaker I blame posting at 6:30AM, before I've had my coffee :) –  MattBelanger Sep 13 '11 at 13:05
add comment

As some indication - there's a Regex class in .NET and regex package in Java; not Regexp. Two fairly large 'ecosystems'. This by itself means more to me than as if some committee, somewhere, decided it this way or that way.

share|improve this answer
4  
In Javascript, it's RegExp –  user1827 Aug 20 '11 at 14:56
add comment

There is no standard that dictates this. As to what is more common, Google says regex vs. regexp by some 13.8 vs 9.8 million finds.

share|improve this answer
    
+1 for actually using some data –  jk. Sep 13 '11 at 11:15
add comment

Regex is much more common, and you might get an odd glance or two if you say Regexp.

share|improve this answer
    
Unless, of course, you said it to a Rubyist. ;) –  Brandon Satrom Aug 20 '11 at 14:07
add comment

what's more standard depends on the predominant language of the folks you're talking to, I would argue. Correct above about Regex in .NET and Java, but Ruby uses the Regexp class for regular expressions.

share|improve this answer
add comment

I have never before this thread seen it shortened to regexp and always seen it as regex. Just to add to the list, the new C++ Standard has <regex>, not <regexp>.

share|improve this answer
add comment

My answer is more morphological. Consider yourself as the first person who wants to provide an abbreviation for this concept (Definitely regex or regexp both come from somewhere and haven't been with us since Adam), and you know that it should come from regular and expression.

My dictionary tells me that reg. is an abbreviated form of regularly and exp. is a shorthand of express. Thus if you want to follow the rules of abbreviations, REGEXP seems more structural. However, forming new words (neologism as they call it) is not always straight and often is done by people who are not linguists. Considering these issues, to make a name which with a more aesthetically appealing pronunciation, you can create REGEX.

Also as a note, StackExchange editor considers regex as wrong spell, while regexp is fine :)

share|improve this answer
1  
SE editor doesn't have Spell Check. –  muntoo Sep 13 '11 at 7:01
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.