Find to the end of repeated char

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
redcairo
Posts: 39
Joined: Fri May 06, 2011 6:34 am

Find to the end of repeated char

Post by redcairo »

Hi,

I have content in text files which may contain any number of underlines that are 2-or-more underline chars together.

These have a combination of inconsistent elements in the text:

1. Two or more will be together (ignore just one), but ALL in a given unbroken string. Quantity of repeat chars will vary.

2. There may not be a space before the underline series

3. There may not be a space after the underline series

The char before/after the underline could be anything

4. If there is a space between two underline series, both need to be separately found and addressed with the replace

5. Every series needs replaced with space, 8-underline-chars, space. If this creates more than one space before/after the underlines, I can 'clean that up' with another S/R later I suppose...


Here is an example of content coming in:

1. Some kind of __ underline _________________ here that is____ totally _______unpredictable and ____ _______ will vary.


I need this kind of result coming out of it:

1. Some kind of ________ underline ________ here that is ________ totally ________ unpredictable and ________ ________ will vary.



I have pieces but I seem to making it worse instead of better the more I work on it. :-) I would really appreciate anyone's kind assistance if you have time.

Best regards,
P
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Post by ak47wong »

Here's one way to do it:

Find what: ~*__+~* [replace ~ with a space]
Replace with: ~________~ [replace ~ with a space]

This will result in two spaces between two underline series, which you can clean up with another S/R.
redcairo
Posts: 39
Joined: Fri May 06, 2011 6:34 am

Post by redcairo »

That worked!! That's excellent!

Thank you so much for your help!!

PJ
Post Reply