curiousity
curiousity

Reputation: 4741

Remove all numbers in brackets with the brackets from string

Trying to remove city code from string for my additional I have wrote the brackets removal with indexOf. how to do this with regex?

Mr Smith (344) 455 66 44

to

Mr Smith 455 66 44

Upvotes: 0

Views: 1665

Answers (1)

Keppil
Keppil

Reputation: 46239

You can use

String clean = str.replaceAll("\\(\\d+\\)", "");

Upvotes: 5

Related Questions