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.
我正在尝试删除以下内容:" (23wr)"
" (23wr)"
要删除我使用过的空格.gsub(/\s+/, ""),但如何删除'('and')'来获取"23wr"?
.gsub(/\s+/, "")
'('
')'
"23wr"
试试这个代码:
gsub(/[\s+)(]/,"")
No regex:
p " (23wr)".delete("( )\t") #=> "23wr"