@@ -831,9 +831,15 @@ jQuery(document).ready(function () {
831
831
$ ( '#subscriptionNameInput' ) . addClass ( "is-invalid" ) ;
832
832
error = true ;
833
833
}
834
-
834
+
835
+ // When this regExp need to be changed then remember to change the one in the
836
+ // back-end (invalidSubscriptionNameRegex in SubscriptionValidator.java), which do the same
837
+ // invalid subscription name check. The two
838
+ // regEx always need to be the same for ensuring the same check.
835
839
// /(\W)/ Is a regex that matches anything that is not [A-Z,a-z,0-8] and _.
836
- var regExpression = / ( \W ) / g;
840
+ var invalidSubscriptionNameRegex = "(\W)" ;
841
+ var regExpressionFlag = "g" ;
842
+ var regExpression = new RegExp ( invalidSubscriptionNameRegex , regExpressionFlag ) ;
837
843
if ( ( regExpression . test ( subscriptionName ) ) ) {
838
844
var invalidLetters = subscriptionName . match ( regExpression ) ;
839
845
$ ( '#invalidSubscriptionName' ) . text (
@@ -866,6 +872,10 @@ jQuery(document).ready(function () {
866
872
var emails = notificationMeta . split ( "," ) ;
867
873
emails . forEach ( function ( email ) {
868
874
email = email . trim ( ) ;
875
+ // When this regExp need to be changed then remember to change the one in the
876
+ // back-end (validEmailRegExpression in SubscriptionValidator.java), which do the same
877
+ // email validation check. The two
878
+ // regEx always need to be the same for ensuring the same check.
869
879
var validEmailRegExpression = / ^ ( ( [ ^ < > ( ) \[ \] \\ . , ; : \s @ " ] + ( \. [ ^ < > ( ) \[ \] \\ . , ; : \s @ " ] + ) * ) | ( " .+ " ) ) @ ( ( \[ [ 0 - 9 ] { 1 , 3 } \. [ 0 - 9 ] { 1 , 3 } \. [ 0 - 9 ] { 1 , 3 } \. [ 0 - 9 ] { 1 , 3 } ] ) | ( ( [ a - z A - Z \- 0 - 9 ] + \. ) + [ a - z A - Z ] { 2 , } ) ) $ / ;
870
880
var isValidEmailAddress = validEmailRegExpression . test ( email ) ;
871
881
if ( ! isValidEmailAddress ) {
0 commit comments