This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +4
-2
lines changed
2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 12
12
// Regex code is obtained from SO: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231
13
13
var ISO_DATE_REGEXP = / \d { 4 } - [ 0 1 ] \d - [ 0 - 3 ] \d T [ 0 - 2 ] \d : [ 0 - 5 ] \d : [ 0 - 5 ] \d \. \d + ( [ + - ] [ 0 - 2 ] \d : [ 0 - 5 ] \d | Z ) / ;
14
14
// See valid URLs in RFC3987 (http://tools.ietf.org/html/rfc3987)
15
- var URL_REGEXP = / ^ [ A - Z a - z ] [ A - Z a - z \d . + - ] * : \/ * (?: \w + (?: : \w + ) ? @ ) ? [ ^ \s / ] + (?: : \d + ) ? (?: \/ [ \w # ! : . ? + = & % @ \- / ] * ) ? $ / ;
15
+ var URL_REGEXP = / ^ [ A - Z a - z ] [ A - Z a - z \d . + - ] * : \/ * (?: \w + (?: : \w + ) ? @ ) ? [ ^ \s / ] + (?: : \d + ) ? (?: \/ [ \w # ! : . ? + = & % @ \- / [ \] $ ' ( ) * , ; ~ ] * ) ? $ / ;
16
16
var EMAIL_REGEXP = / ^ [ a - z 0 - 9 ! # $ % & ' * + \/ = ? ^ _ ` { | } ~ . - ] + @ [ a - z 0 - 9 ] ( [ a - z 0 - 9 - ] * [ a - z 0 - 9 ] ) ? ( \. [ a - z 0 - 9 ] ( [ a - z 0 - 9 - ] * [ a - z 0 - 9 ] ) ? ) * $ / i;
17
17
var NUMBER_REGEXP = / ^ \s * ( \- | \+ ) ? ( \d + | ( \d * ( \. \d * ) ) ) ( [ e E ] [ + - ] ? \d + ) ? \s * $ / ;
18
18
var DATE_REGEXP = / ^ ( \d { 4 } ) - ( \d { 2 } ) - ( \d { 2 } ) $ / ;
Original file line number Diff line number Diff line change @@ -2544,11 +2544,13 @@ describe('input', function() {
2544
2544
expect ( URL_REGEXP . test ( 'mailto:user@example.com?subject=Foo' ) ) . toBe ( true ) ;
2545
2545
expect ( URL_REGEXP . test ( 'r2-d2.c3-p0://localhost/foo' ) ) . toBe ( true ) ;
2546
2546
expect ( URL_REGEXP . test ( 'abc:/foo' ) ) . toBe ( true ) ;
2547
+ expect ( URL_REGEXP . test ( 'http://example.com/path;path' ) ) . toBe ( true ) ;
2548
+ expect ( URL_REGEXP . test ( 'http://example.com/[]$\'()*,~)' ) ) . toBe ( true ) ;
2547
2549
expect ( URL_REGEXP . test ( 'http:' ) ) . toBe ( false ) ;
2548
2550
expect ( URL_REGEXP . test ( 'a@B.c' ) ) . toBe ( false ) ;
2549
2551
expect ( URL_REGEXP . test ( 'a_B.c' ) ) . toBe ( false ) ;
2550
2552
expect ( URL_REGEXP . test ( '0scheme://example.com' ) ) . toBe ( false ) ;
2551
- expect ( URL_REGEXP . test ( 'http://example.com:9999/~~ ``' ) ) . toBe ( false ) ;
2553
+ expect ( URL_REGEXP . test ( 'http://example.com:9999/``' ) ) . toBe ( false ) ;
2552
2554
} ) ;
2553
2555
} ) ;
2554
2556
} ) ;
You can’t perform that action at this time.
0 commit comments