我想匹配正则表达式并获得匹配字符串中的位置
例如,
"AustinTexasDallasTexas".match_with_posn /(Texas)/
我想match_with_posn返回类似的内容:[6, 17]其中6和17是德克萨斯这两个实例的起始位置.
match_with_posn
[6, 17]
有这样的事吗?
ruby regex
regex ×1
ruby ×1