cancel
Showing results for 
Search instead for 
Did you mean: 

Using negative look-ahead in non-native regex ?

Highlighted
Occasional 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
Highlighted
Community Hero

Re: Using negative look-ahead in non-native regex ?

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
Highlighted
Community Hero

Re: Using negative look-ahead in non-native regex ?

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 Hero]
____
[Community Heroes] 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 Heroes]
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 Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
================================
New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
A new challenge is here!

Create a function to drag one element to another for the TechCorner tag!

Will you dare to take the challenge?


Scripts created in July:
- Passing custom command-line arguments as a test parameter
Top Kudoed Authors