18 January 2026:


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.

problem in usage of regular expression and match function

edited November -1 in Sahi - Open Source
Hi,
I am doing parameterisation.I have kept all the user ids and passwords in text.txt.
All the userids are five digit numbers(for ex:63609,64723,63241 etc.)I want that ONLY USERS WITH USERIDS
STARTING WITH 63 SHOLD ONLY LOGin and NOT ALL.
My code is this;

var $content = _readFile("D:\\sahi\\Data\\text.txt");

var $lines = new Array();
$lines = $content.split("\r\n");
var $len=$lines.length;
_alert($len);

for (var $i = 0; $i < $len; $i++)
{

var exp=new RegExp("63\d*"); //trying to use regular expression

if($lines.match(exp))
{

$uid = $lines[$i].split(" ");
_setValue(_textbox("txtId"), $uid[0]);
_setValue(_password("txtPwd"), $uid[1]);
_click(_submit("Login"));
_click(_link("Log Off"));

}

}

But this code is showing error that"JSERROR TypeError: Cannot find function match."

How to solve this issue provided here I have to use regular expression only.

thank u

Comments

Sign In or Register to comment.