[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Oracle procedure question related to ID: 27979957

Posted on 2013-01-07
5
Medium Priority
?
347 Views
Last Modified: 2013-01-07
I had a question answered for parsing characters out of a string etc....I want to enhance this query further. I found that in certain circumstances there is a part of a string that starts with { , has text after it, and ends with a }....What I need to do is take this whole portion out of the text being returned. Below is the function that I need this logic added too, if I can....

regexp_replace(col1,'[^a-zA-Z0-9: ' || chr(10) || chr(13)|| '-]');

Example of data:

Jones played '~(`|¤|football)~' and baseball at '~(¦%|¥|Mobile County Training School)~' in '~(`|¤|{link:10098}|Mobile, Alabama,)~' and Alabama A&M University.

The above function will return this

Jones played football and baseball at Mobile County Training School in {link:10098} Mobile, Alabama, and Alabama A&M University.

I need everything between { and } , including the curly brackets, removed...

Thanks
JK
0
Comment
Question by:jknj72
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 77

Accepted Solution

by:
slightwv (䄆 Netminder) earned 2000 total points
ID: 38750886
See if this is what you are after:
select regexp_replace(col1,'{.*}|[^a-zA-Z0-9: ' || chr(10) || chr(13)|| '-]') from tab1;
0
 

Author Comment

by:jknj72
ID: 38751020
Yes that worked but I do have a question before I finish this. I need to keep certain characters in the text field like periods and back slashes, etc... Is there any way I can include what characters to keep and not get rid of?
0
 

Author Comment

by:jknj72
ID: 38751033
Actually I just included the characters in the 2nd argument and it worked. I think Im good....For now anyways...
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 38751043
>>Is there any way I can include what characters to keep and not get rid of?

Yes.  I mentioned this in the previous questions, just add the characters you want to keep to the list inside the square brackets (the '-' MUST be the last one in the list):  [^a-zA-Z0-9: ' || chr(10) || chr(13)|| '-]

The potential issue is if the 'keep' characters are part of the string in the 'special' characters you want to remove.

If you run into this, we may need a more complex regular expression.

Keep a list of the edge case's data and if you need to ask a new question, provide ALL the sample data and expected results for each.
0
 

Author Comment

by:jknj72
ID: 38751259
will do, thanks slight...
0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Question has a verified solution.

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

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.​
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
This video explains at a high level about the four available data types in Oracle and how dates can be manipulated by the user to get data into and out of the database.
This video shows how to Export data from an Oracle database using the Datapump Export Utility.  The corresponding Datapump Import utility is also discussed and demonstrated.

656 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