๐ย Reference
๐ย Chapter
String)์ ๋ฉ์๋๋ก, ์ ๊ท ํํ์๊ณผ ์ผ์นํ๋ ํญ๋ชฉ์ ์ธ๋ฑ์ค(์์น)๋ง ๋ฐํํ๋ค.-1๋ฅผ ๋ฐํํ๋ค.str.search(regexp)
regexp
obj ๊ฐ ์ ๋ฌ๋๋ฉด, ๊ทธ๊ฒ์ new RegExp(obj) ์ ์ด์ฉํ์ฌ RegExp ์ผ๋ก ์๋ฌต์ ์ผ๋ก ๋ณํ๋๋ค.-1 ๋ฐํ.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: "."