The same approach applies to different libraries, so we describe it here using Java as an example.

Using Regex

Suppose that we have an object jTextField1 that were recorded using a locator:

The location string in this case is:

frame0/JPanel/jTextField1

Suppose that developers changed the name from jTextField1 to jTextFieldName and we need to tweak the locator to work with both versions of the app. Here we may use special regex: syntax to say that given part of location should be treated as a regular expression, i.e.:

frame0/JPanel/regex:(jTextField1|jTextFieldName)

It is possible that more than one section requires the tweaking, i.e. if root frame has also been renamed from frame0 to frame, we may have a locator looking like:

regex:frame.*/JPanel/regex:(jTextField1|jTextFieldName)

Using Custom Delimiter

By default the Java locator uses '/' to split parts of the locator.  If you need to use '/' in the regular expression, then escape it using '\', i.e.: \/.

The Managed locator uses '.' as a location parts separator. I.e.:

MainForm.autLabel

However, it may use different separator. The separator may be re-defined if used as a first symbol, i.e.:

/MainForm/autLabel

- here the first '/' means use / as a separator. So for managed objects you may choose a separator that is not a part of your regular expression to make a safe locator.