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.

Issue with Regular expression with SAHI V 3.5

Akss004Akss004 Members
edited November -1 in Sahi - Open Source
Hi Narayan,

I have found some issue with SAHI's latest release regarding Regular expression.

Some of my Scripts start getting failed while i have migrated my regression test scripts execution with latest release if SAHI.

For e.g.

_exists(_span("/03/01/2011 11:00:00.*04/01/2011 11:00:00.*/"));

this was running and still running with older version of SAHI . But this not running with SAHI V 3.5 and due to this many of Test Cases are Failed in result.

Is there any changes with Pattern changes with usage of regular expression????

Comments

  • narayannarayan Administrators
    Hey Akash,

    Not sure how it worked with an older version. The forward slashes need escaping in the regular expression.

    _exists(_span("/03\/01\/2011 11:00:00.*04\/01\/2011 11:00:00.*/"));

    should be the right way.

    Regards,
    Narayan
  • Hi Narayan,

    Original Element:-

    _span("03/01/2011 11:00:00 PM - 04/01/2011 11:00:00 PM - 0")

    We were using following regular expression with SAHI's previous version.

    _exists(_span("/03/01/2011 11:00:00.*04/01/2011 11:00:00.*/"));

    and that was working fine.

    And the same is not working with this new version and we have also tried with

    _exists(_span("/03\/01\/2011 11:00:00.*04\/01\/2011 11:00:00.*/"));


    and its still not working. Its giving some syntax error which means regular expression is not proper in above line.

    ERROR:- [Exception] SyntaxError: missing ; before statement
  • narayan wrote:
    Hey Akash,

    Not sure how it worked with an older version. The forward slashes need escaping in the regular expression.

    _exists(_span("/03\/01\/2011 11:00:00.*04\/01\/2011 11:00:00.*/"));

    should be the right way.

    Regards,
    Narayan

    Got Solution!!!!!

    need to use...

    _exists(_span("/03\\/01\\/2011 11:00:00.*04\\/01\\/2011 11:00:00.*/"));

    Instead of....

    _exists(_span("/03\/01\/2011 11:00:00.*04\/01\/2011 11:00:00.*/"));


    Its working fine now.
  • narayannarayan Administrators
    Hey Akash,

    Thanks for sharing this. Yes the back slashes need to be double escaped. Sorry that my solution may have misled you.

    Regards,
    Narayan
Sign In or Register to comment.