当前位置:   article > 正文

java toregex,將Java Regex轉換為javascript Regex

java正则转js正则

0

var myregexp = /([a-zA-Z0-9_\-])([a-zA-Z0-9_\.+~!#\/$%^&*_=\'?\-]*)@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(\.[A-Za-z0-9]{2,})$/;

187446ead595a5a4c313e5149ded1449.png

Debuggex演示

Description

描述

1st Capturing group ([a-zA-Z0-9_\-])

[a-zA-Z0-9_\-] match a single character present in the list below

a-z a single character in the range between a and z (case sensitive)

A-Z a single character in the range between A and Z (case sensitive)

0-9 a single character in the range between 0 and 9

_ the literal character _

\- matches the character - literally

2nd Capturing group ([a-zA-Z0-9_\.+~!#\/$%^&*_=\'?\-]*)

[a-zA-Z0-9_\.+~!#\/$%^&*_=\'?\-]* match a single character present in the list below

Quantifier: Between zero and unlimited times, as many times as possible, giving back as needed [greedy]

a-z a single character in the range between a and z (case sensitive)

A-Z a single character in the range between A and Z (case sensitive)

0-9 a single character in the range between 0 and 9

_ the literal character _

\. matches the character . literally

+~!# a single character in the list +~!# literally

\/ matches the character / literally

$%^&*_= a single character in the list $%^&*_= literally (case sensitive)

\' matches the character ' literally

? the literal character ?

\- matches the character - literally

@ matches the character @ literally

[A-Za-z0-9-]+ match a single character present in the list below

Quantifier: Between one and unlimited times, as many times as possible, giving back as needed [greedy]

A-Z a single character in the range between A and Z (case sensitive)

a-z a single character in the range between a and z (case sensitive)

0-9 a single character in the range between 0 and 9

- the literal character -

3rd Capturing group (\.[A-Za-z0-9-]+)*

Quantifier: Between zero and unlimited times, as many times as possible, giving back as needed [greedy]

Note: A repeated capturing group will only capture the last iteration. Put a capturing group around the repeated group to capture all iterations or use a non-capturing group instead if you're not interested in the data

\. matches the character . literally

[A-Za-z0-9-]+ match a single character present in the list below

Quantifier: Between one and unlimited times, as many times as possible, giving back as needed [greedy]

A-Z a single character in the range between A and Z (case sensitive)

a-z a single character in the range between a and z (case sensitive)

0-9 a single character in the range between 0 and 9

- the literal character -

4th Capturing group (\.[A-Za-z0-9]{2,})

\. matches the character . literally

[A-Za-z0-9]{2,} match a single character present in the list below

Quantifier: Between 2 and unlimited times, as many times as possible, giving back as needed [greedy]

A-Z a single character in the range between A and Z (case sensitive)

a-z a single character in the range between a and z (case sensitive)

0-9 a single character in the range between 0 and 9

$ assert position at end of the string

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号