mirror of
https://github.com/fofolee/uTools-quickcommand.git
synced 2025-09-23 20:44:42 +08:00
编排添加正则提取/替换
This commit is contained in:
@@ -103,10 +103,14 @@ const textProcessing = {
|
||||
substring: function (text, start, end) {
|
||||
return text.substring(start, end);
|
||||
},
|
||||
// 正则提取
|
||||
regexExtract: function (text, regex) {
|
||||
const match = text.match(regex);
|
||||
return match ? match[0] : "";
|
||||
// 正则处理
|
||||
regexTransform: function (text, regex, replace) {
|
||||
try {
|
||||
if (replace === undefined) return text.match(regex);
|
||||
return text.replace(regex, replace);
|
||||
} catch (e) {
|
||||
throw "正则表达式格式错误";
|
||||
}
|
||||
},
|
||||
// 非对称加解密
|
||||
asymmetricCrypto: function (config) {
|
||||
|
Reference in New Issue
Block a user