Linkarea and Substring Function

Posted by Agung Pambudi in , ,
I have a template that is a LinkArea.

I want to activate only the links that start with a specific text. E.g. V65

See attached screendump.

The XPath is curently /A[.]='V65'

However the name of the links are: V65 (Tรค), V65 (Mp), V65 (Ax)

I want to compare the first 3 characters of each link name to V65. What should I do? In VB Script I would just write Left(/A[.],3)...

Thanks for any help :-)





Answer:


Hi,

Maybe you can try input XPath manually.

//A[matches(., 'V[0-9]{1,}')]

You can study XPath from w3schools website.



Excellent!

The following code does the job: //A[matches(., 'V65')]

No comments:

Post a Comment