Skip to content
Advertisement

regular expressions – same for all languages?

is the regexp the same between languages?

for example. if i want to use it in javascript, would i have to search for regexp for javascript specifically. cause i got some cheat sheets. it just says regular expression.

i wonder if i could use this on all languages, php, javascript and so on.

Advertisement

Answer

The basics are mostly the same but there are some discrepancies between which engine powers the language, PHP and JavaScript differ since PHP uses PCRE (Perl Compatible Regular Expressions).

PHP also has the POSIX-compatible regex engine (ereg_* functions), but that is deprecated.

If you don’t already use it, I suggest you try RegexBuddy. It can convert between several Regex engines.

You can find alternatives for RegexBuddy on Mac here.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement