1// Javascript Regex Reference
2// /abc/ A sequence of characters
3// /[abc]/ Any character from a set of characters
4// /[^abc]/ Any character not in a set of characters
5// /[0-9]/ Any character in a range of characters
6// /x+/ One or more occurrences of the pattern x
7// /x+?/ One or more occurrences, nongreedy
8// /x*/ Zero or more occurrences
9// /x?/ Zero or one occurrence
10// /x{2,4}/ Two to four occurrences
11// /(abc)/ A group
12// /a|b|c/ Any one of several patterns
13// /\d/ Any digit character
14// /\w/ An alphanumeric character (“word character”)
15// /\s/ Any whitespace character
16// /./ Any character except newlines
17// /\b/ A word boundary
18// /^/ Start of input
19// /$/ End of input
1// get "bucket1337" from https://bucket1337.appspot.com.storage.googleapis.com/staging/blender_input/162480.glb"
2
3//define string
4let string = "https://bucket1337.appspot.com.storage.googleapis.com/staging/blender_input/162480.glb"
5
6//define regexp
7let bucketRegex = new RegExp(`(?<=https:\/\/).*(?=.app)`, 'gm')
8
9// execute regexp
10let result = string.match(bucketRegex)[0]
1// Tests website Regular Expression against document.location (current page url)
2if (/^https\:\/\/example\.com\/$/.exec(document.location)){
3 console.log("Look mam, I can regex!");
4}
1var s = "Please yes\nmake my day!";
2s.match(/yes.*day/);
3// Returns null
4s.match(/yes[^]*day/);
5// Returns 'yes\nmake my day'