18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
Trouble using regular expression
Hi,
I am downloading pincodes from Indian Postal website. At one point, I want extraxt a value from a string (for example, the value 17 from the string "Search result:17 Results found"). I am using regular expression. the code is -
var $str = document.getElementById('lbl_remarks');
var $count = $str.match(/\d+/g);
_alert($count);
But the Sahi playback failed with the error log saying -
_alert(document.getElementById("lbl_remarks").match(/\d+\//));
TypeError: document.getElementById("lbl_remarks").match is not a function
Please let me know if I am doing some mistake somewhere and help me fix the problem.
I am using Windows XP Professional SP 3 and Mozilla FF 3.6.23. The Sahi version is sahi_20101103.
I am downloading pincodes from Indian Postal website. At one point, I want extraxt a value from a string (for example, the value 17 from the string "Search result:17 Results found"). I am using regular expression. the code is -
var $str = document.getElementById('lbl_remarks');
var $count = $str.match(/\d+/g);
_alert($count);
But the Sahi playback failed with the error log saying -
_alert(document.getElementById("lbl_remarks").match(/\d+\//));
TypeError: document.getElementById("lbl_remarks").match is not a function
Please let me know if I am doing some mistake somewhere and help me fix the problem.
I am using Windows XP Professional SP 3 and Mozilla FF 3.6.23. The Sahi version is sahi_20101103.
Comments
Provide more details if you want the exact result.