Created
November 16, 2021 14:33
-
-
Save abdes-zakari/a94b7c1576ac9fe0ebb309111b273249 to your computer and use it in GitHub Desktop.
Javascript Regex Test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Javascript Regex Test example | |
/* | |
[0-9]+ => Matches any digit (+) => one or more | |
\d{4} => Matches 4 digit | |
n^ =>Matches any string with n at the beginning of it | |
n$ => Matches any string with n at the end of it | |
\d{1,} Matches at least 1 or more of Digit | |
*/ | |
var pattern = /^\/auftrag\/edit\/AB-(\d{4})-([0-9]+)$/; | |
var pattern2 = /^\/auftrag\/edit\/AB-(\d{4})-(\d{1,})$/; | |
//014657 | |
var res = pattern2.test("/auftrag/edit/AB-2021-155464"); | |
console.log(res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment