유용한 사이트
https://regexper.com/
https://regexr.com/
let pattern = /a/
let pattern = new RegExp('a')
let pattern = /a/
let pattern = new RegExp('a')
let str1 = 'abcdefg'
let str2 = 'bcdefg'
pattern.exec(str1) // ['a']
pattern.exec(str2) // null
pattern.test(str1) // true
pattern.test(str2) // false
let pattern = /a/
let pattern = new RegExp('a')
let str1 = 'abcdefg'
let str2 = 'bcdefg'
str1.match(pattern) // ['a']
str2.match(pattern) // null
str1.replace(pattern, 'A') // ['Abcdefg']
let pattern = /a/
let patterni = /a/i
let str1 = 'Abcdefg'
str1.match(pattern) // null
str1.match(patterni) // ['A']
let pattern = /a/
let patterng = /a/g
let str1 = 'abcdefga'
str1.match(pattern) // ['a']
str1.match(patterng) // ['a', 'a']
let patternig = /a/ig