아래는 계산기 로직을 작성하는 도중 쓴 정규식이다.
let checkOctal = input.replace(/^0+(?=\\d)/, "");
/ : 시작과 끝
^ : 문자열 시작 위치
$ : 문자열 끝
const start = /^hello/ //hello로 시작하는 문자열
const end = /world$/ //world로 끝나는 문자열
console.log(start.test("hello world")); //true
console.log(end.test("hello world")); //true
console.log(start.test("world hello")); //false
console.log(end.test("world hello")); //false