💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 组件源码 ``` /** * <b>方法描述:</b> 正则表达式检查 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2020-12-18 15:53:55 <br/> * * @param instrs * 入参|字段值列表|{@link List} * @param exprs * 入参|正则表达式列表|{@link List} * @return 0 失败<br/> * 1 成功<br/> */ @Component(label = "正则表达式检查", style = "判断型", type = "同步组件", comment = "正则表达式判断,待检查字段的list下标和表达式list下标要一致。", version = "1.0.0", deprecated = false, author = "admin", date = "2020-12-18 03:53:55") @InParams(param = {@Param(name = "instrs", comment = "字段值列表", type = List.class), @Param(name = "exprs", comment = "正则表达式列表", type = List.class)}) @Returns(returns = {@Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功")}) @Order(value = 2) public static ResultBase P_regxCtrl(List instrs, List exprs) { if (instrs == null || exprs == null) { return ResultBase.newFailureResult("TPTV0004", "正则表达式检查输入参数不能为空"); } int i = 0; for (Object val : instrs) { if (i >= exprs.size()) { break; } String strExp = (String)exprs.get(i); String strValue = val.toString(); if (!java.util.regex.Pattern.matches(strExp, strValue)) { return ResultBase.newFailureResult("TPTV0005", "正则表达式检查不匹配"); } } return ResultBase.newSuccessResult(); } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/ee/58/ee585055b9a750ebbbf148a307b58965_1868x892.png) # 参数说明及示例 ## 入口参数 字段值列表:输入检查列表,示例: `["123"]` 正则表达式列表:输入对应的正则表达式列表,示例: `["\\d+"]`