此页面是 正则模式 对应的 API 说明,你可以查看 索引 来寻找需要的 API。
Regexp Mode For English Version Is Here
Index For English Version Is Here
正则模式下 API 需要如下参数:
plain(可选):你想要搜索/匹配的文本,默认为空pattern(可选):你想要匹配/搜索的正则表达式,默认为空method(可选):你想要使用的匹配方法,默认为matchcount(可选):仅在使用findSome方法时需要此参数,该方法会在plain中搜索所有与pattern匹配的子串,并且取这个列表的前count项返回。若不指定count或count字段无法被解析为数字,将会默认令count为 -1,此时效果与findAll相同。
可用方法
可使用的方法如下,大/小写不影响。
match:若plain和pattern匹配成功则返回plain字段,状态码为 200;否则返回空串,状态码为 300。find:若在plain中搜索到与pattern匹配的子串,则返回第一个搜索到的子串,状态码为 200;否则返回空串,状态码为 300。findindex:若在plain中搜索到与pattern匹配的子串,则以字符串形式返回第一个搜索到的子串的起始下标和结束下表,中间用逗号分隔,状态码为 200;否则返回空串,状态码为 300。findall:在plain中搜索到与pattern匹配的子串,返回所有匹配子串的集合,状态码为 200;否则返回空集合,状态码为 300。findsome:在plain中搜索到与pattern匹配的子串,将匹配子串的前count项作为一个集合返回,状态码为 200;否则返回空集合,状态码为 300。
1 | > curl http://api.forec.cn/regexp?plain=peach&pattern=pe.ch |