inverted subpattern

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

Post Reply
JoeBlack
Posts: 2
Joined: Tue May 07, 2013 6:07 pm

inverted subpattern

Post by JoeBlack » Tue May 07, 2013 6:17 pm

Hello.

I need to find lines containing different numbers at the end. Numbers must not be equal. For example:

Code: Select all

anyword  33
anyword  45
This regexp is not working.

Code: Select all

anyword\s+(\d+)\s+anyword\s+(?!\1)
I can find lines with equal numbers:

Code: Select all

anyword\s+(\d+)\s+anyword\s+\1
But how to find lines with different numbers?

And more one question.

Is there an option which could replace found pattern with counter? Counter is a variable that changes in increment of one in every replace. The initial value equals to zero. Seen this option in another software.

User avatar
DataMystic Support
Site Admin
Posts: 2206
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: inverted subpattern

Post by DataMystic Support » Mon May 13, 2013 9:56 am

I agree that it looks like it should work. I also tried it in another application that uses the PCRE engine, and it also does not work, so perhaps it is a failing of the PCRE engine. Have you tried any other tools?

For counting matches, add a VBScript subfilter to your search/replace - it will get passed the replacement and can make changes to it, such as adding a counter value.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

JoeBlack
Posts: 2
Joined: Tue May 07, 2013 6:07 pm

Re: inverted subpattern

Post by JoeBlack » Thu May 16, 2013 5:35 am

I tried another tools and online services without success.

I used advasar for counting and replacing. Its very old tool and not supported anymore. BTW it have some interesting options. You can check it.

User avatar
DataMystic Support
Site Admin
Posts: 2206
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: inverted subpattern

Post by DataMystic Support » Thu May 16, 2013 10:05 am

Yes, I think the (?! ... ) syntax is intended for a literal string, not a reference.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests