I am not sure exactly how you are trying to do this, but if you are doing:
swtBotTree.expandNode("constant part of string" + ".*", true);
Then you are most likely doing it wrong...
The javadoc for expandNode gives no mention that it supports regular expressions...
Looking into the source (just some version I found when searching), expandNode
uses another method called getItem(...)
. That method does something like if (item.getText().equals(nodeText))
. In other words, that method uses string equality comparison, not regex matching.
In Java, there is support for regular expressions (take a look at Pattern javadoc and Matcher javadoc or on String.matches(...) javadoc), but only if that functionality is used in the implementation. You cannot pass a regex to a method which expects a normal String and expect it to do regex matching.
Short answer:
Java has classes which provide regex functionality, but the SWTBotTree.expandNode(String, boolean)
method does not support regex.
EDIT:
As far as I understand, there is no direct support in SWTBotTree
for doing regex/wildcard lookups.
If you desperately want to do this, you could try something like:
for(SWTBotTreeItem item : swtBotTree.getAllItems()){
if(item.getText().matches("some regex goes here")){
item.expand();
}
}