Solved

SQL parse parens and contents in between

Posted on 2011-03-07
4
303 Views
Last Modified: 2012-05-11
Looking to strip out parenthesis (and contents) in a product's description.

For example:

IS:
Chocolate 0.6m (1.96 ft.) Braided

MAKE:
Chocolate Braided

would also like to strip out the "0.6m" if possible too.

Any ideas?
0
Comment
Question by:globalwm2
  • 2
4 Comments
 
LVL 74

Expert Comment

by:sdstuber
ID: 35060314
regexp_replace(yourstring,' ?\([^)]+\)')
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 35060315
Is it always first and last word?

What are some of the other terms that need stripped?

More sample data and expected results would help a lot.
0
 
LVL 74

Accepted Solution

by:
sdstuber earned 125 total points
ID: 35060338
oops, missed the "also" part

how is that identified?  the word immediately preceeding the parenthentic section?

if so, try this...

regexp_replace(yourstring,' .+ \([^)]+\)')

if that's not the rule, please explain how to identify which pieces of your string stay and which are removed
0
 

Author Closing Comment

by:globalwm2
ID: 35060577
Thanks - I can work with this for my needs.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error querying database link from Oracle 10g to Postgresql 7 68
error in my cursor 5 41
oracle date format checking 7 26
SQL Select in Access 2003 3 26
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to take different types of Oracle backups using RMAN.

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question