cancel
Showing results for 
Search instead for 
Did you mean: 

regular expressions not working in javascript using clickItem

SOLVED
Occasional Contributor

regular expressions not working in javascript using clickItem

Hi everyone,

 

I'm have some trouble with the regular expression in javascript while using clickItem.

 

I'm using this code: 

Aliases.HealthWin32.MainForm.MDIClient.frmLiveMessages.pnlClient.SplitterMain.TRzSplitterPane.pnlTreeview.tvMessages.ClickItem("regexp:\|Boîte de réception.*\|eHealth Box.*)");

and I'm always getting the following error:

The TreeView node 'regexp:' not found.

I did try a few thing but nothing does it.

Does anyone have any ideas, am I doing somthing wrong ? 

As per the documentation, what I'm doing seems to be correct.

 

thank you

Phlippe

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: regular expressions not working in javascript using clickItem

Hi Phil,

 

a) Thank you for the update;

b) Just recollected after reading your message that in some cases it was required to enclose regexp subexpressions with parenthesis in order they match (this is documented but I don't have a link at hand). So you may try this:

.tvMessages.ClickItem(/(\\|Boîte de réception.*)\\|(\\|eHealth Box.*)/);

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================

View solution in original post

7 REPLIES 7
Community Hero

Re: regular expressions not working in javascript using clickItem

Hi,

 

> As per the documentation, what I'm doing seems to be correct.

Can you provide a link to the help topic?

I am not sure that regular expressions are supported to specify the full path to some tree view item.

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Occasional Contributor

Re: regular expressions not working in javascript using clickItem

Community Hero

Re: regular expressions not working in javascript using clickItem

Well... Thank you for the link... It looks that it should be possible indeed...

Just two ideas to check:

a) Duplicate slashes in the regexp string. I.e.:

.ClickItem("regexp:\\|Boîte de réception.*\\|eHealth Box.*)");

 

b) Try to use JavaScript-specific syntax (see code sample in the "Specifying Variable Parts in Object Captions" paragraph of the referenced help topic). Like this:

.ClickItem(/\\|Boîte de réception.*\\|eHealth Box.*)/);

 

Does this help?

 

P.S. There seems to be non-paired closing parentheses in your code sample. May it be another problem?

.ClickItem("regexp:\|Boîte de réception.*\|eHealth Box.*)");

 

Shouldn't it be either

.ClickItem("regexp:\\|Boîte de réception.*\\|eHealth Box.*\\)");

or just

.ClickItem("regexp:\\|Boîte de réception.*\\|eHealth Box.*");

?

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================
Occasional Contributor

Re: regular expressions not working in javascript using clickItem

Hi Alex,

 

the regex seems to be working but it can't find the TreeView, but this is another story Smiley Happy

I use the following: 

Aliases.HealthWin32.MainForm.MDIClient.frmLiveMessages.pnlClient.SplitterMain.TRzSplitterPane.pnlTreeview.tvMessages.ClickItem(/\\|Boîte de réception.*\\|eHealth Box.*/);

 

Thank you for your help, and thank you for pointing out the ')' whicih was not escaped Smiley Tongue

Occasional Contributor

Re: regular expressions not working in javascript using clickItem

Hi Alex,

 

The regular expression wasn't  working at all, I always had an error stating that it couldn't find the expression and the searched term was: '<This is blank>', empty string, which was not correct, so I ended up using wildcards instead

 

ClickItem("*eHealth Box*")

And this worked like a charm.

 

Thank again for your help

 

Phli

Community Hero

Re: regular expressions not working in javascript using clickItem

Hi Phil,

 

a) Thank you for the update;

b) Just recollected after reading your message that in some cases it was required to enclose regexp subexpressions with parenthesis in order they match (this is documented but I don't have a link at hand). So you may try this:

.tvMessages.ClickItem(/(\\|Boîte de réception.*)\\|(\\|eHealth Box.*)/);

 

Regards,
Alex
[Community Expert Group]
____
[Community Expert Group] members 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. Postings made by [Community Expert Group] members
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.
[Community Expert Group] signature is used with permission by SmartBear Software.
http://smartbear.com/forums/f83/t86934/community-experts/
================================

View solution in original post

Occasional Contributor

Re: regular expressions not working in javascript using clickItem

Thank Alex taht seemed to do the trick Smiley Wink

 

New Here?
Join us and watch the welcome video:
Watch the new Interview