我有像
View_Export_US_Horizontals_Ultimate_DirectionalSurveys
我想提取匹配项,比如
[["US_Horizontals", "Ultimate", "DirectionalSurveys"]] //String Ultimate may or may not be present
我有下面的正则表达式,/^View_Export_(US\_(GoM|Horizontals|Onshore))((_Ultimate)?)_(\w+)/
但我得到以下匹配数组
[["US_Horizontals", "Horizontals", "_Ultimate", "_Ultimate", "DirectionalSurveys"]]
如何跳过Horizontals
&;之类的字符串;_Ultimate
然后得到一个数组,比如
[["US_Horizontals", "Ultimate", "DirectionalSurveys"]]
或
[["US_Horizontals", "DirectionalSurveys"]]