Ask a Question

regular expressions not working in javascript using clickItem

SOLVED
mathotp
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

7 REPLIES 7
AlexKaras
Community Hero

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 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
================================
mathotp
Occasional Contributor
AlexKaras
Community Hero

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 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
================================
mathotp
Occasional Contributor

Hi Alex,

 

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

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 😛

mathotp
Occasional Contributor

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

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 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
================================
mathotp
Occasional Contributor

Thank Alex taht seemed to do the trick 😉

 

cancel
Showing results for 
Search instead for 
Did you mean: