N
N
Newmo2019-05-24 12:30:20
go
Newmo, 2019-05-24 12:30:20

How to remove everything in parentheses from text?

We have a line like:

Gigabyte GA-B250M-DS3H (1,485)MSI B250M PRO-VD (MS-7A74) (1,199)MSI H110M PRO-VH PLUS (MS-7A15) (946)Asus H110M-K (816)Asrock B250M-HDV (807)MSI B250M PRO-VDH (MS-7A70) (667)MSI H110M PRO-VD (MS-7996) (663)

How can I remove all brackets with information in them?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-05-24
@Newmo

str := "Gigabyte GA-B250M-DS3H (1,485)MSI B250M PRO-VD (MS-7A74) (1,199)MSI H110M PRO-VH PLUS (MS-7A15) (946)Asus H110M-K (816)Asrock B250M-HDV (807)MSI B250M PRO-VDH (MS-7A70) (667)MSI H110M PRO-VD (MS-7996) (663)"
reg, _ := regexp.Compile("\\(.*?\\)")
str = reg.ReplaceAllString(str, "")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question