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.

One more about regexp..

psylencepsylence Members
edited November -1 in Sahi - Open Source
Sorry, still cannot make this regular expressions thing working, though read several topics about that.

I have a field with name like content[4925][_title] and this number is always changing. How can i make my scripts working with it?

I use such code to verify and fill this field:
$addWritingTitleField = "content[][_title]";

....
_assertEqual($title, _textbox($addWritingTitleField).value);
_setValue(_textbox($addWritingTitleField), "");

Comments

  • narayannarayan Administrators
    In regular expressions,

    . (a dot) means any character/number
    * means any number of times
    [ and ] have special meaning too.

    In your case you should be able to use

    $addWritingTitleField = /content\[.*\]\[_title\]/;


    Since [ and ] have special meaning, they have to be escaped using a backslash. The .* will replace any numbers between the first square brackets.

    Hope that helps.
    Regards,
    Narayan
  • Narayan, big thanks for your response. That worked for me though i need to learn more about regexp) This topic can be closed.
This discussion has been closed.