1//Declare Reg using slash
2let reg = /abc/
3//Declare using class, useful for buil a RegExp from a variable
4reg = new RegExp('abc')
5
6//Option you must know: i -> Not case sensitive, g -> match all the string
7let str = 'Abc abc abc'
8str.match(/abc/) //Array(1) ["abc"] match only the first and return
9str.match(/abc/g) //Array(2) ["abc","abc"] match all
10str.match(/abc/i) //Array(1) ["Abc"] not case sensitive
11str.match(/abc/ig) //Array(3) ["Abc","abc","abc"]
12//the equivalent with new RegExp is
13str.match('abc', 'ig') //Array(3) ["Abc","abc","abc"]
1// \d Any digit character
2// \w An alphanumeric character (“word character”)
3// \s Any whitespace character (space, tab, newline, and similar)
4// \D A character that is not a digit
5// \W A nonalphanumeric character
6// \S A nonwhitespace character
7// . Any character except for newline
8// /abc/ A sequence of characters
9// /[abc]/ Any character from a set of characters
10// /[^abc]/ Any character not in a set of characters
11// /[0-9]/ Any character in a range of characters
12// /x+/ One or more occurrences of the pattern x
13// /x+?/ One or more occurrences, nongreedy
14// /x*/ Zero or more occurrences
15// /x?/ Zero or one occurrence
16// /x{2,4}/ Two to four occurrences
17// /(abc)/ A group
18// /a|b|c/ Any one of several patterns
19// /\d/ Any digit character
20// /\w/ An alphanumeric character (“word character”)
21// /\s/ Any whitespace character
22// /./ Any character except newlines
23// /\b/ A word boundary
24// /^/ Start of input
25// /$/ 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]