MCPcopy Create free account
hub / github.com/chavyleung/scripts / matchStr

Function matchStr

zsfc/zsfc.treasure.js:172–177  ·  view source on GitHub ↗

* 从输入字符串中提取指定关键字的值。 * * @param {string} input - 输入字符串,要从中提取关键字的值。 * @param {string} key - 要提取的关键字。 * @returns {string} - 返回匹配到的关键字值,如果没有匹配到则返回空字符串。

(input, key)

Source from the content-addressed store, hash-verified

170 * @returns {string} - 返回匹配到的关键字值,如果没有匹配到则返回空字符串。
171 */
172function matchStr(input, key) {
173 const separator = input.includes("&") ? "&" : ";";
174 const pattern = new RegExp(`${key}=([^${separator}]+)`);
175 const match = input.match(pattern);
176 return match ? match[1] : '';
177}
178
179/**
180 * @description 等待一段时候。

Callers 1

zsfc.treasure.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected