This thread is continued here (I screwed up the format of the initial post).
auto repetition of regex-based search & replace: re=post
Auto repeating regex-based search & replace
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
- Posts: 3
- Joined: Thu Apr 22, 2004 3:26 pm
- Location: UK
- Contact:
Auto repeating regex-based search & replace
Last edited by iangalbraith on Thu Apr 22, 2004 7:31 pm, edited 1 time in total.
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
Your sample is unclear. Nothing shows up as repeated. Nothing shows up with white space, or indents on any line. Forum presentation automatically removes leading spaces.
Perhaps to help the presentation you could use a string of ........ to represent the blank space. You could also enhance that by using a white font for those spaces. See samples below.
Using ........ to show white space
Abadham, Harvey v. H65/24
Abarrow, Radford v. R23/47
..........Abbes, Claxton v. C129/19
..........Kinwellmarsh v. K26/98
Parmenter v. P40/32
Using ........ with white font to show white space
Abadham, Harvey v. H65/24
Abarrow, Radford v. R23/47
..........Abbes, Claxton v. C129/19
..........Kinwellmarsh v. K26/98
Parmenter v. P40/32
Would also be good to show samples of before and after records. Would also be helpful to see your Search and Replace RegEx strings.
Perhaps to help the presentation you could use a string of ........ to represent the blank space. You could also enhance that by using a white font for those spaces. See samples below.
Using ........ to show white space
Abadham, Harvey v. H65/24
Abarrow, Radford v. R23/47
..........Abbes, Claxton v. C129/19
..........Kinwellmarsh v. K26/98
Parmenter v. P40/32
Using ........ with white font to show white space
Abadham, Harvey v. H65/24
Abarrow, Radford v. R23/47
..........Abbes, Claxton v. C129/19
..........Kinwellmarsh v. K26/98
Parmenter v. P40/32
Would also be good to show samples of before and after records. Would also be helpful to see your Search and Replace RegEx strings.
Last edited by Bob Hansen on Thu Apr 22, 2004 4:35 pm, edited 1 time in total.
Hope this was helpful.............good luck,
Bob
Bob
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
Turn on regular expressions.
Record a macro:
Record a macro:
Code: Select all
<F5>
Find what: ^[[:space:]]+ [or whatever suits]
<RET>
<ESC>
<UP>
<F5>
Find what: ,
<RET>
<ESC>
<RIGHT>
<Shift-HOME>
<Ctrl-C>
<F5>
Find what: ^[[:space:]]+
<RET>
<ESC>
<Shift-LEFT>
<Ctrl-V>
- Bob Hansen
- Posts: 1516
- Joined: Sun Mar 02, 2003 8:15 pm
- Location: Salem, NH
- Contact:
I just saw your earlier second post on this subject. I did not reply to that yet, to allow you the opportunity to delete that thread completely. Would be good to only have one instance of the subject.
Suggest that you copy its content, remove it, and resubmit in this thread so only one thread will exist for this subject. I think you can Delete it if no one else has posted a reply. If not, then perhaps delete content, and mention thread is continued here, and provide a link to this page.
Suggest that you copy its content, remove it, and resubmit in this thread so only one thread will exist for this subject. I think you can Delete it if no one else has posted a reply. If not, then perhaps delete content, and mention thread is continued here, and provide a link to this page.
Hope this was helpful.............good luck,
Bob
Bob
- s_reynisson
- Posts: 939
- Joined: Tue May 06, 2003 1:59 pm
Here's my version!
Using POSIX style regex, you can enable it from the Edit menu in Configure->Preferences.
Find ^([[:word:]]+,)(.+)\n[[:space:]]
Replace \1\2\n\1
Edit: Improved regex after iangalbraith reply below
Simply hold down Alt-R as needed.
You can also record a macro using these keystrokes, pressing Alt-R twice in the replace dialog (works fine).
As a result I get something like:
using this as input (three spaces at start of those lines):
HTH
Using POSIX style regex, you can enable it from the Edit menu in Configure->Preferences.
Find ^([[:word:]]+,)(.+)\n[[:space:]]
Replace \1\2\n\1
Edit: Improved regex after iangalbraith reply below
Simply hold down Alt-R as needed.
You can also record a macro using these keystrokes, pressing Alt-R twice in the replace dialog (works fine).
As a result I get something like:
Code: Select all
Abadham, Harvey v. H65/24
Abarrow, Radford v. R23/47
Abbes, Claxton v. C129/19
Abbes, Kinwellmarsh v. K26/98
Abbes, Parmenter v. P40/32
Abbey, Clarke v. C114/23
Abbey, Harrison Kt. v. H95/24
Abbey, Snawsdale v. S49/3
Abbey, Tooker v. T19/22,61/127
Abbott, Antram v. A8/41
Abbott, Ashton v. A7/55
Abbott, Bacon v. B44/22
Abbott, Ballard v. B110/40
Abbott, Kt., Barnes v. B12/64
Abbott, Battersby v. B135/12
Code: Select all
Abadham, Harvey v. H65/24
Abarrow, Radford v. R23/47
Abbes, Claxton v. C129/19
Kinwellmarsh v. K26/98
Parmenter v. P40/32
Abbey, Clarke v. C114/23
Harrison Kt. v. H95/24
Snawsdale v. S49/3
Tooker v. T19/22,61/127
Abbott, Antram v. A8/41
Ashton v. A7/55
Bacon v. B44/22
Ballard v. B110/40
Kt., Barnes v. B12/64
Battersby v. B135/12
Last edited by s_reynisson on Thu Apr 22, 2004 8:34 pm, edited 1 time in total.
Then I open up and see
the person fumbling here is me
a different way to be
the person fumbling here is me
a different way to be
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
-
- Posts: 3
- Joined: Thu Apr 22, 2004 3:26 pm
- Location: UK
- Contact:
Phew! Amazing response. Thanks folks, this is a great forum. The Alt-R was what I didn't know about and it solved the problem. (Grateful thanks to HTH). Bob Hansen - I did what you suggested about edited the original posting, though a bit late now !
The regex I was using was:
Find: ^\([A-Z][a-z]+\)\(.*\)\n
Replace: \1\2\n\1
where there is a trailing space in each case, for I had already edited the "indents" to a single space.
Anyway, it seems my problem is now solved, and I can proceed with more confidence that my decision to use regex-based text editing was the right one.
Thanks again.
Ian
The regex I was using was:
Find: ^\([A-Z][a-z]+\)\(.*\)\n
Replace: \1\2\n\1
where there is a trailing space in each case, for I had already edited the "indents" to a single space.
Anyway, it seems my problem is now solved, and I can proceed with more confidence that my decision to use regex-based text editing was the right one.
Thanks again.
Ian