πΒ Reference
πΒ Index
str.search(regexp)
regexp
: μ κ· ννμ κ°μ²΄. non-RegExp κ°μ²΄ obj
κ° μ λ¬λλ©΄, κ·Έκ²μ new RegExp(obj)
μ μ΄μ©νμ¬ RegExp
μΌλ‘ μ묡μ μΌλ‘ λ³νλλ€.const paragraph = 'The quick brown fox jumps over the lazy dog. If the dog barked, was it really lazy?';
// any character that is not a word character or whitespace
const regex = /[^\\w\\s]/g;
console.log(paragraph.search(regex));
// expected output: 43
console.log(paragraph[paragraph.search(regex)]);
// expected output: "."