Skip to content

Latest commit

 

History

History
17 lines (15 loc) · 360 Bytes

1678. 设计 Goal 解析器.md

File metadata and controls

17 lines (15 loc) · 360 Bytes
  • 正则表达式
/**
 * @param {string} command
 * @return {string}
 */
var interpret = function (command) {
    const map = {
        "()": "o",
        "(al)": "al",
    };
    return command.replace(/\(al\)|\(\)/g, (match) => map[match]);
};