codestates / codestates/LearnRegex
[๐พ ErrorLog] ์ ๊ทํํ์ exec ๋ฌดํ๋ฃจํ
- Dominant language
- JavaScript
- Stars
- 2
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
์ด๋ค ์๋ฌ์ธ๊ฐ?
* ์ฝ๋ ๊ตฌ์ฑ ์ค ํน์ ์ ๊ทํํ์์์ exec๋ฅผ ๋ฌดํํ ์คํํ๊ฒ ๋ง๋๋ ๊ฒฝ์ฐ ์์ธ์ฒ๋ฆฌ๋ฅผ ๋ชปํ์
* ์๋ฅผ๋ค์ด, ์
๋ ฅ๋ ์ ๊ทํํ์์ด `.*`์ผ ๊ฒฝ์ฐ, 1๋ฒ ๊ฒ์ํ ํ ๋ค์ ๊ฒฐ๊ณผ๊ฐ ๊ฐ์ฅ ๋ง์ง๋ง ์ธ๋ฑ์ค๋ฅผ ๊ฐ๋ฆฌํด
๊ทธ ์ํ์์ ๋ค์ while๋ฌธ์ผ๋ก ๋์์ exec๋ฅผ ์ํ
`*`๋ฌธ์๋ ๊ฒ์ ๊ฒฐ๊ณผ๊ฐ ์์ด๋ ๊ฒฐ๊ณผ๊ฐ์ ํฌํจ
๋ฌดํ๋ฃจํ๊ฐ ๋ง๋ค์ด์ง
```js
while ((matchArray = myRegex.exec(testCase)) !== null) {
console.log('test');
lastIndex = matchArray.index;
highlightedTestCase += data.testCase.substring(startIndex, lastIndex);
highlightedTestCase += "" + matchArray[0] + '';
startIndex = myRegex.lastIndex;
// result = matchArray[0];
}
highlightedTestCase += data.testCase.substring(startIndex, data.testCase.length);
// return result;
};
```
์๋ฌ ๋ฉ์์ง

์๋ฌ ํด๊ฒฐ ๋ฐฉ๋ฒ
* testcase์ ๊ธธ์ด๋ฅผ ํ์ธ
* ๊ฐ์ฅ ๋ง์ง๋ง ์ธ๋ฑ์ค์ผ ๊ฒฝ์ฐ, ํน์ ๋ฌธ์๋ก ๋๋๋ ์ ๊ทํํ์์ ์์ธ์ฒ๋ฆฌ `*`, `?`

์๋ฌ ํด๊ฒฐ์ ์ํด ์ฐธ๊ณ ํ ๋ ํผ๋ฐ์ค ๋งํฌ
*
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.