Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences in regex between java .net and javascript?

I'm working on a multiplatform system. We would like to use regex to test strings in a certain format. The regex would be written once in a db and used by the 3 different platforms. So do you know if there are differences in the manner the regex are written? If yes, is it totally different or only a few things are different?

Here is an example:

[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}

Regards

like image 476
jobe Avatar asked Sep 13 '12 07:09

jobe


People also ask

What is the difference between net and JavaScript?

The difference is that JavaScript is a programming language while .NET is a platform for developing applications. .NET includes among others: class library classes for developing different types of applications such as windows and web applications. common language runtime provides run time services.

What is the difference between Java&JavaScript?

In this article, we will know about Java & Javascript, & also see the significant distinction between Java & Javascript. JavaScript is a lightweight programming language (“scripting language”) and is used to make web pages interactive. It can insert dynamic text into HTML.

What is the difference between Java and JavaScript variable types?

In Java, the type of a variable is checked at compile-time. JavaScript is a weakly typed language and has a more relaxed syntax and rules. Java is an object-oriented programming language.

What is the difference between Java program and JavaScript program?

Java program has file extension “.Java” and translates source code into bytecodes which is executed by JVM (Java Virtual Machine). JavaScript file has file extension “.js” and it is interpreted but not compiled,every browser has the Javascript interpreter to execute JS code.


1 Answers

Simple regex patterns will be fine across different implementations, however there are defferences for more complex matches. Yet there are limited number of common variations, namely POSIX and Perl regex. So you can have two columns for them in DB, which will be quite enough in most of the cases.

like image 180
Petr Abdulin Avatar answered Oct 07 '22 02:10

Petr Abdulin