Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which is the correct shorthand - "regex" or "regexp" [closed]

/regexp?/    


Googlefight says regex wins, 685000 to 289000 (which is about 2.37:1).

Also, regexp is strange to say out loud because there are so few (if any?) words that end in a "-ksp" sound, but there are plenty of words that end in a "-ecks" sound.


They are both OK. "regex" is more common, but "regexp" has been used more widely than the other answers here indicate. Some examples:

  • Henry Spencer referred to his famous library as "regexp" as early as 1986. (http://groups.google.com/group/mod.sources/msg/ab37bf1ead7209ec?)
  • The Jargon File listed "regexp (also regex, reg-ex)" as early as 1991. (http://groups.google.com/group/misc.misc/msg/e75ca9cb78220ea0?)
  • JavaScript and Ruby both have Regexp or RegExp in their standard libraries.

regex is shorter; therefore, better :) Also, it is easier to pronounce.


The accepted shorthand is "regex".

"Regexp" is only used, in my experience, in the context of Javascript where the object representing a regular expression is actually called RegExp.


I think "regex" is more common (e.g., Java package java.util.regex). If 10,000 Elvis fans can't be wrong, then I'd vote for that on the strength of numbers.


According to Wikipedia

In computing, regular expressions, also referred to as regex or regexp, ...