Been a while since I fired this up..
Could anybody remind me of the best way to replace any other instance of a character (except for the first) per line please?
Bit of background: I have a 2 column CSV file that is semicolon delimited. I would like any other instance of a semicolon APART from the first instance replacing with a space.
Thank you.
Replace any other instance of character per line
Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators
-
- Posts: 987
- Joined: Sun Dec 09, 2007 2:49 am
- Location: UK
Re: Replace any other instance of character per line
Use a PCRE pattern Restrict filter:
David
(a long time user of TextPipe)
Code: Select all
Comment...
| Replace all but the first semicolon on each line by a space
|
+--Perl pattern [^(.*;)(.+)$] and Send variable 2 to subfilter
| [X] Match case
| [ ] Whole words only
| [ ] Case sensitive replace
| [ ] Prompt on replace
| [ ] Skip prompt if identical
| [ ] First only
| [ ] Extract matches
| Maximum text buffer size 4096
| [ ] Maximum match (greedy)
| [ ] Allow comments
| [ ] '.' matches newline
| [X] UTF-8 Support
|
+--Replace [;] with [\x20]
[X] Match case
[ ] Whole words only
[ ] Case sensitive replace
[ ] Prompt on replace
[ ] Skip prompt if identical
[ ] First only
[ ] Extract matches
[ ] Process longest strings first
[ ] Simultaneous search
[ ] Log summary only
(a long time user of TextPipe)
David