verify an item is within square brackets

i have a situation where i need to check if the selected item is native language or english.  native languages are enclosed in square brackets.  how can i check for square brackets.

  • Assuming the string is contained in a webedit or perhaps a weblement, then I would say that the easiest way would be via a GetROProperty method. e.g.

    if you don't care about the string content, you can use a regular expression to check the string begins and ends with [ and ] and the text in the middle can be anything. (as [ and ] are special characters the \ is to ensure they are treated as literals)

    if browser(...).Page(...).Webelement(...).GetRoProperty("innertext") = "\[.*\]" then
           ' native language
           ' english
    End if