🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 组件源码 ``` /** * <b>方法描述:</b> 正则表达式匹配 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-09-18 10:28:15 <br/> * * @param text * 入参|输入字符串|{@link java.lang.String} * @param regex * 入参|表达式|{@link java.lang.String} * @param match * 出参|是否匹配|{@link boolean} * @return -1 异常<br/> * 0 失败<br/> * 1 成功<br/> */ @Component(label = "正则表达式匹配", style = "选择型", type = "同步组件", comment = "输入字符是否匹配输入表达式", version = "1.0.0", deprecated = false, author = "admin", date = "2018-09-18 10:28:15") @InParams(param = { @Param(name = "text", comment = "输入字符串", type = java.lang.String.class), @Param(name = "regex", comment = "表达式", type = java.lang.String.class) }) @OutParams(param = { @Param(name = "match", comment = "是否匹配", type = boolean.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功") }) public static ResultBase P_matcher(String text, String regex) { try { boolean match = Pattern.matches(regex, text); if (match) return ResultBase.newSuccessResult(true); else return ResultBase.newFailureResult("TPTS1019", "字符串不匹配表达式"); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTS1019", "匹配正则表达式异常:" + AppLog.errorMsg(e)); } } ``` # 交易中组件使用方式 ![](https://img.kancloud.cn/fd/a0/fda090314d51de8de4c8cf6da419a50e_1868x890.png) # 参数说明及示例 ## 入口参数 输入字符串:输入字符串,示例: `"18512548562"` 表达式:正则表达式,示例: `"\\d+"` ## 出口参数 是否匹配:输入字符串是否匹配输入表达式,示例: `__INNER__["result"]`