[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [StrongED] Re: Another S&R query



In message <56bf72aaeeLists@xxxxxxxxxxx>
          "Richard Torrens (lists)" <Lists@xxxxxxxxxxx> wrote:

> In article <04686bbf56.Alan.Adams@xxxxxxxxxxxxxxxxxxxxxx>,
>    Alan Adams <alan@xxxxxxxxxxxxxxxx> wrote:
> > Hi
> 
> > I have a text file containing things like
> 
> > FredFred0175423245789
> > BillMany876542335778
> > Joe FJoe F3457y89567268
> 
> > I want to remove the first part of the line IF it is duplicated 
> > immediately afterwards.
> 
> > In the above, remove Fred from line 1, and Joe F from line 3.
> 
> > Can this be done?
> 
> Try
> SEARCH:  {'A-Z'}+ {'a-z'}+ * @1  @01 REPLACE: @01
> 
> It gets part way there! Joe F is more difficult:
> 
> SEARCH:  {'A-Z'}1:1 {'a-z'}+ " " {'A-Z'}1:1 @1  @01 REPLACE: @01
> finds Joe F...
> 
> I don't think you can do it in one! Fred may disagree!

It's not an easy one to find but I got there in the end.

S: < @0 'A-Z' {'a-z'}+ [" " 'A-Z' {'a-z'}] @1 @01
R: @01

Note that if you want to use @0 or @9 in a back reference then it must
be set explicitly. If you don't set it then it will be defined _after_
a match is found, meaning it will have a bogus value during the search.

Cheers,
Fred.

-- 
StrongED Developer
http://www.stronged.iconbar.com/

-- 
To unsubscribe send a mail to StrongED+unsubscribe@xxxxxxxxxxx
List archives and instructions at
http://diy.Torrens.org/RO/StrongED/index.html