[JS] RegExp match & test
var str = "The rain in SPAIN stays mainly in the plain";
var res = str.match(/ain/g);
https://www.w3schools.com/jsref/jsref_match.asp
JavaScript String match() Method
JavaScript String match() Method ❮ JavaScript String Reference --> Example Search a string for "ain": var str = "The rain in SPAIN stays mainly in the plain"; var res = str.match(/ain/g); The result of res will be an array with the values: var str = "The
www.w3schools.com
const str = 'table football';
const regex = RegExp('foo*');
console.log(regex.test(str));
// expected output: true
https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test
RegExp.prototype.test()
The test() method executes a search for a match between a regular expression and a specified string. Returns true or false.
developer.mozilla.org
https://developer.mozilla.org/ko/docs/Web/JavaScript/Guide/%EC%A0%95%EA%B7%9C%EC%8B%9D
정규 표현식
정규 표현식은 문자열에 나타는 특정 문자 조합과 대응시키기 위해 사용되는 패턴입니다. 자바스크립트에서, 정규 표현식 또한 객체입니다. 이 패턴들은 RegExp의 exec 메소드와 test 메소드 ,��
developer.mozilla.org