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.

RegExp in Sahi

tower120tower120 Members
edited November -1 in Sahi - Open Source
Hi!

I need to parse value from DOM element. So I try this:

$amount_payable_text = _getText( _cell(1, _in ( _row("amount_payable") )) );
$amount_payable = amount_payable_text.match(/[0-9.]+/);

_alert($amount_payable_text) shows that text is ok.
_alert($amount_payable) - shows "recursive_access".

What I do wrong?

Comments

  • narayannarayan Administrators
    amount_payable_text.match(/[0-9.]+/);

    should have been

    $amount_payable_text.match(/[0-9.]+/);

    ?
  • Yes, thats just my typo when I write that post. In code that written correct. Problem still not solved.
    Looks like it does not recognize $amount_payable_text as String object.
  • Hi tower120,

    Can you try using this:

    $amount_payable = "" + $amount_payable_text.match(/[0-9.]+/);

    instead of

    $amount_payable = amount_payable_text.match(/[0-9.]+/);

    Let me know if this solves your issue.

    Regards
    Sumitra
  • tower120tower120 Members
    edited September 2011
    Yes, this works for me, thx.
This discussion has been closed.