Ask a Question

Using negative look-ahead in non-native regex ?

GGuezet
Contributor

Using negative look-ahead in non-native regex ?

Hi everyone, I'm currently trying to make a nice regex allowing me to get all processes with a certain name.

For that, I'm using Sys.FindAll("ProcessName", "regexp:MyRegex")

 

I want to find, for exemple, all the processes with a name starting with "myProcess_" but excluding "myProcess_other"

 

I've constructed the following regex :

 

(myProcess_(?!.*(other)).+)

This regex works perfectly fine in many regex testing websites.

 

Then, i'm using it like that :

 

Sys.FindAll("ProcessName", "regexp:(myProcess_(?!.*(other)).+)")

But it's failling to find any processes.

Any time i'm using a negative look-ahead, it's not finding anything.

 

Any suggestions ?

 

Thanks

2 REPLIES 2
tristaanogre
Esteemed Contributor

Regular expressions used in the TestComplete Find methods are syntaxed differently than regular expressions used as native regular expressions from scripting languages.  I'm not very familiar with them, but you can find the specific syntaxes here

 

https://support.smartbear.com/testcomplete/docs/reference/misc/regular-expressions.html

 

See if that helps.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
AlexKaras
Champion Level 2

Hi,

 

I am far not sure that negative look-ahead is supported by the regex engine used by TestComplete.

For official answer you may ask Support via the https://support.smartbear.com/message/?prod=TestComplete form and I will appreciate it if you update this thread with their reply.

 

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
cancel
Showing results for 
Search instead for 
Did you mean: