-1

xpath = ".//*[@id='ctl00_ctl00_MainContent_ChildContent1_dgDataList_ctl06_btnEdit']";

here 106 is varying every time , how to use regular expression in xpath

Rakesh Kumar
  • 19
  • 1
  • 6

1 Answers1

0
xpath = ".//*[matches  (@id, 'ctl00_ctl00_MainContent_ChildContent1_dgDataList_ct\d+_btnEdit']"; 
Maertin
  • 384
  • 1
  • 8
  • Thanks, but "\d" shows as invalid expression and displasy error on the line. is it something i am missing ? – Rakesh Kumar Nov 25 '15 at 21:37
  • XPATH 2.0 has support for regular expressions, I believe. If its 1.0, then you need to check this link.http://stackoverflow.com/questions/405060/can-i-use-a-regex-in-an-xpath-expression – Maertin Nov 25 '15 at 21:48