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.
如何仅使用正则表达式提取单词的中间字母,例如:
"someWord" -> "e" or "W" no sense "Hello" -> "l" "Music" -> "s" "four" -> "o" or "u" no sense
由于我不知道你使用什么环境和语言,我可以给你一个大概的方案:
pattern = '^.{' + Int(Length(str)/2) + '}(.)'
或者
pattern = '(?<=^.{' + Int(Length(str)/2) + '}).'