GO语言"regexp"包中"Regexp.NumSubexp"类型的用法及代码示例。
用法:
func(re *Regexp) NumSubexp() int
NumSubexp 返回此 Regexp 中带括号的子表达式的数量。
例子:
package main
import (
"fmt"
"regexp"
)
func main() {
re0 := regexp.MustCompile(`a.`)
fmt.Printf("%d\n", re0.NumSubexp())
re := regexp.MustCompile(`(.*)((a)b)(.*)a`)
fmt.Println(re.NumSubexp())
}
输出:
0 4
相关用法
- GO Regexp.FindString用法及代码示例
- GO Regexp.FindAllIndex用法及代码示例
- GO Regexp.ReplaceAllLiteralString用法及代码示例
- GO Regexp.FindStringSubmatch用法及代码示例
- GO Regexp.FindAllString用法及代码示例
- GO Regexp.ExpandString用法及代码示例
- GO Regexp.FindAllStringSubmatch用法及代码示例
- GO Regexp.SubexpIndex用法及代码示例
- GO Regexp.Match用法及代码示例
- GO Regexp.Longest用法及代码示例
- GO Regexp.FindStringIndex用法及代码示例
- GO Regexp.ReplaceAll用法及代码示例
- GO Regexp.Expand用法及代码示例
- GO Regexp.Find用法及代码示例
- GO Regexp.SubexpNames用法及代码示例
- GO Regexp.FindAllSubmatchIndex用法及代码示例
- GO Regexp.FindSubmatchIndex用法及代码示例
- GO Regexp.FindAllStringSubmatchIndex用法及代码示例
- GO Regexp.MatchString用法及代码示例
- GO Regexp.ReplaceAllString用法及代码示例
注:本文由纯净天空筛选整理自golang.google.cn大神的英文原创作品 Regexp.NumSubexp。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。