Page 1 of 1

Find to the end of repeated char

Posted: Fri Sep 23, 2011 10:51 pm
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

Posted: Sat Sep 24, 2011 8:29 am
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.

Posted: Sun Sep 25, 2011 11:16 am
by redcairo
That worked!! That's excellent!

Thank you so much for your help!!

PJ