Split string into array using multi-character delimiter
问题 I need to split a string into an array. My problem is that the delimiter is a 3 character one: _-_ For example: db2-111_-_oracle12cR1RAC_-_mariadb101 I'd need to create the following array: db2-111 oracle12cR1RAC mariadb101 Similar questions followed this approach: str="db2-111_-_oracle12cR1RAC_-_mariadb101" arr=(${str//_-_/ }) echo ${arr[@]} Even if the array is created, it has been split uncorrectly: db2 111 oracle12cR1RAC mariadb101 It seems that the "-" character in the first item causes