Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8666477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:44:28+00:00 2026-06-12T17:44:28+00:00

Using PL/SQL, how can I remove sentences, except the first occurrence of a sentence

  • 0

Using PL/SQL, how can I remove sentences, except the first occurrence of a sentence that begin with the words This product? Assume every sentence ends with a period (.) and that each sentence begins with an uppercase letter; for example:

 v_desc varchar2(500);
 v_desc := 'This product is used. Product may make you wealthy. This product may appear red. This product is not new.';

My attempts:

 v_desc := regexp_replace(v_desc,'This product*{2,}','') ;
 v_desc := regexp_replace(v_desc,'This product*{2,}*','') ;

Desired results

v_desc := 'This product is used. Product may make you wealthy.';
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:44:29+00:00Added an answer on June 12, 2026 at 5:44 pm

    Try this:

     v_desc := regexp_replace(v_desc,'[^^](This product).*[.]', '') ;
    

    Here’s the break down:

    [^^] = Not the beginning of the line
    (This product).*[.] = Searching for all instances of "This product" followed by a "."
    

    This will end up searching for all Instances of “This product …” that is not at the beginning of the line.

    *Edit after comment

    Then what you want is a positive look behind (?<=). It should look like this:

     v_desc := regexp_replace(v_desc,'(?<=(This product).*)(This product).*[.]', '') ;
    

    Breakdown:

    (?<=(This product).*) = Positive lookbehind.  
    (This product).*[.] = What is being searched for
    

    It will only trigger the next value as true if the expression “This product …” is before it. This will prevent the first occurrence of “This product” from showing up in the values to be replaced.

    I would like to point out, that the lookaheads and lookbehinds are not supported on all implantation of Regex. I don’t know the specifics of PL/SQL, so I cannot guarantee this will work. It does work when I test on Regex Hero.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using the SQL Server PHP Driver, I think this question can be
For example using SQL I can do: SELECT (a+b) as c FROM table WHERE
i am using sql server 2000 can i use full text search on the
Using SQL Server 2005, how can I authenticate a username/password pair against a non-AD
I can drop a SqlServer Backup Device using SQL-DMO using the following pseudo-code: SQLDMO.SQLServer2
Can we find all tables in the msaccess using sql . as we do
How can I update an entity effectively in hibernate just as by using SQL.
I was wondering how you can recover data from your logfile. I'm using sql
Using t-sql, how can i find if all SQL Logins have strong passwords on
I am wondering if you can use Linq to SQL using a .mdf file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.