I am going through some data in MySQL and I need to remove some information from a column which looks likes this.
**sometext** (something else)
The data is inconsistent unfortunately; not all of the data follows this structure, some of it just has the first part.
**sometext**
So I need a way to remove everything between the brackets and then the brackets themselves in order to just leave the **sometext** part.
Use this solution:
Keep in mind that due to the limitation of MySQL’s minimal regex support, this will not work for (will return blank):
…if you want to keep
keepthistext1andkeepthistext2since it will remove everything between the first opening parenthesis and the last closing parenthesis.SQLFiddle Demo