java .net和javascript之间正则表达式的差异? [英] Differences in regex between java .net and javascript?

查看:50
本文介绍了java .net和javascript之间正则表达式的差异?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究多平台系统。我们想使用正则表达式来测试某种格式的字符串。正则表达式将在db中编写一次,并由3个不同的平台使用。所以你知道正则表达式的写法是否存在差异?如果是,它是完全不同还是只有少数不同?

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?

以下是一个例子:

[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

推荐答案

简单的正则表达式模式适用于不同的实现,但对于更复杂的比赛有任何偏差。然而,有一些常见的变体,即POSIX和Perl正则表达式。所以你可以在DB中有两列,在大多数情况下都足够了。

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.

这篇关于java .net和javascript之间正则表达式的差异?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆