0

I use a program called TextPad to edit Excel Spreadsheets as part of my job. I was wondering if somebody knew a regex to delete a sentence ending with "..." only. In the below example, they happen to be at the end of every paragraph, so that might make it easier.

Example:

In 2017, small categories such as candle air fresheners and liquid air fresheners continued to emerge and develop in Kazakhstan. Both categories account for low sales in Kazakhstan. Furthermore, the availability of such products is not as strong as it is for spray/aerosol air fresheners and the brand range is narrow; however, there was slowly increasing interest from consumers in more-sophisticated and unusual offers. The key consumers of candle air fresheners and liquid air fresheners are those...

Just to add on to this so you can get a better picture, below is an example of two full descriptions that I'd work on (I'd post the 500 but there isn't enough room!):

"In 2017, small categories such as candle air fresheners and liquid air fresheners continued to emerge and develop in Kazakhstan. Both categories account for low sales in Kazakhstan. Furthermore, the availability of such products is not as strong as it is for spray/aerosol air fresheners and the brand range is narrow; however, there was slowly increasing interest from consumers in more-sophisticated and unusual offers. The key consumers of candle air fresheners and liquid air fresheners are those...

This market report offers a comprehensive guide to the size and shape of the market at a national level. It provides the latest retail sales data (historic date range), allowing you to identify the sectors driving growth. It identifies the leading companies, the leading brands and offers strategic analysis of key factors influencing the market - be they new product developments, packaging innovations, economic/lifestyle influences, distribution or pricing issues. Forecasts to 2022 illustrate how the market is set to change.

Product coverage: Candle Air Fresheners, Car Air Fresheners, Electric Air Fresheners, Gel Air Fresheners, Liquid Air Fresheners, Other Air Care, Spray/Aerosol Air Fresheners.

Data coverage: market sizes (historic and forecasts), company shares, brand shares and distribution data.

Why buy this report? * Get a detailed picture of the Air Care market; * Pinpoint growth sectors and identify factors driving change; * Understand the competitive environment, the market’s major players and leading brands; * Use five-year forecasts to assess how the market is predicted to develop."

"Air care is set to have a good performance over the forecast period as the category has been growing at a moderate pace. Improving living standards in the country aligned with increasing purchasing power will bolster sales, as Latvian consumers will continue to pay increasing attention to the scent of their homes. However, they do not perceive air care as essential, which makes the category more dependent on consumers’ purchasing power. In the event of any economic slowdown, sales are expected t...

This market report offers a comprehensive guide to the size and shape of the market at a national level. It provides the latest retail sales data (historic date range), allowing you to identify the sectors driving growth. It identifies the leading companies, the leading brands and offers strategic analysis of key factors influencing the market - be they new product developments, packaging innovations, economic/lifestyle influences, distribution or pricing issues. Forecasts to 2022 illustrate how the market is set to change.

Product coverage: Candle Air Fresheners, Car Air Fresheners, Electric Air Fresheners, Gel Air Fresheners, Liquid Air Fresheners, Other Air Care, Spray/Aerosol Air Fresheners.

Data coverage: market sizes (historic and forecasts), company shares, brand shares and distribution data.

Why buy this report? * Get a detailed picture of the Air Care market; * Pinpoint growth sectors and identify factors driving change; * Understand the competitive environment, the market’s major players and leading brands; * Use five-year forecasts to assess how the market is predicted to develop."

As you can see, the first paragraph of each reports end with a sentence that ends with "...", which I'm trying to remove.

  • Possible duplicate of [Learning Regular Expressions](https://stackoverflow.com/questions/4736/learning-regular-expressions) – Biffen Feb 27 '18 at 11:48
  • @Biffen Thank you :-) – Tim Biegeleisen Feb 27 '18 at 11:49
  • @JosephCalanni Do you want to delete *lines* or *sentences*? The title says one thing and the question another. – Biffen Feb 27 '18 at 11:49
  • @Biffen Sorry, I want to delete sentences within paragraphs (this sentence happens to be at the end of every paragraph in this instance) that end with "..." – Joseph Calanni Feb 27 '18 at 11:54
  • @JosephCalanni Is a sentence simply something that doesn't contain `.` (or possibly `?!:`, etc.), or can it be more complex than that? – Biffen Feb 27 '18 at 11:56
  • @Biffen If you look at the above example, I just want to delete the bolded line at the end of that paragraph. There are 500 instances of this within the Excel sheet, so it's not feasible to do it manually. The paragraphs can vary in context, but all of the culprits I would like to get rid of end with "..." and are the last line of said paragraph. – Joseph Calanni Feb 27 '18 at 12:00
  • @JosephCalanni `s/\s*[^.?!:]+\.{3}//g`? – Biffen Feb 27 '18 at 12:01
  • @Biffen Thanks Biffen, but that didn't work either. I've updated the initial question with some more information which may help. – Joseph Calanni Feb 27 '18 at 12:12
  • @JosephCalanni [Works fine for me.](https://regex101.com/r/LlEjAo/1) I guess it's related to the regex dialect you're using. – Biffen Feb 27 '18 at 12:32
  • @Biffen I see, I did think that the software applications that we're supplied with in the office are quite dated. *TextPad 7.4.1 (64-bit Edition)* Nonetheless, thank you for you help and have a great day! – Joseph Calanni Feb 27 '18 at 12:46

1 Answers1

0

Here we start our sentence after the previous .?! and end it with ... . We've added exceptions for a number with a decimal point 1.5 and for initials as in Mr A. Brown or A.B.C.

([\s\S]((?<![\.\?\!])|([0-9]\.[0-9])|( ([A-Z]\.)+ )))*\.{3}