How to spot an instance?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By danilo00782

Hello, everyone

For example, my instance is called @Instance@ID.

Is there a way to check if half of the name matches, then the result is true.

I think also to add in autoload, but there will be many types of instances.

What’s your suggestion?

:bust_in_silhouette: Reply From: tuon

You can use the String functions

begins_with()
ends_with()

If the string begins or end with the same string each time.

If it doesn’t, then check out the RegEx class, in particular capturing groups to check if a string matches the regular expression and capturing sub-strings for id’s and such.

:bust_in_silhouette: Reply From: deaton64

Hi,
Also, if you just want to know your instance name has the word Instance in it, you can use in

Something like:

if "Instance" in object.name: