使用Regex作为分隔符来分割字符串

我想将以下字符串拆分为两个子字符串。 “somestring(otherstring)” 我带来了以下正则表达式分裂
"somestring(otherstring)".split(/(.+)((.+))/)
但这排除了以下字符串,其中没有大括号中的子字符串.. “somestring” 如何更改正则表达式,以便即使没有模式“(otherstring)”的子字符串,它仍然会生成第一个子字符串作为输出。 非常感谢!     
已邀请:
>> "somestring(otherstring)".split(/[()]/)
=> ["somestring", "otherstring"]
>> "somestring".split(/[()]/)
=> ["somestring"]
    
尝试使用这样的东西作为正则表达式:
/([^()]+)(?:((.+)))?/
。     

要回复问题请先登录注册