Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可能重复: 匹配括号之间的整数
匹配括号之间的整数的正则表达式是什么?例如,
"ASDF[ 4 ]" "ZXCd[6]" "qwerr [ 77 ]"
匹配的字符串将是 "4","6","77"
问题是,我不知道任何可以匹配整数并忽略空格的正则表达式。有什么想法吗?
试试这个,
(?<=\[\s*)\d+(?=\s*\])