Is there a symbol which means 'any character'?

this is kinda hard to explain, but i want my script to see if there is a string which has a certain name (eg. "Weapon") and then see if there is a character next to it (eg. "Weapon0", "Weapon1", etc) i know if you search something in windows file browser, you can type * or something after the word and it will find anything which has that word plus another character or so. If someone can make sense of this and knows how to do this it would be appreciated.

A sample regex to find Weapon and any other characters following it could look like:

string pattern = "^Weapon.*$"

To get you started understanding regex, that regex means, "At the start of the string, there must be the string Weapon, followed by any character (the dot), zero or more times (the asterix), followed by end of string.

This pattern would match

  • Weapon (Since it starts with Weapon, and have zero other characters after it)
  • Weapon0 (Since it starts with Weapon, and have one other character after it)
  • WeaponFoobar (Since it starts with Weapon, and have six other characters after it)

But would not match

  • 6Weapon (Since it doesn't start with Weapon)
  • Weapo15 (Since it doesn't start with Weapon, but Weapo)
  • FooWeaponBar (Since it doesn't start with Weapon)

string.Contains would match 6Weapon and FooWeaponBar since it contains the string "anywhere".

string.StartWith would work just as the regex described above. It would accept any string that start with the string passed in. Kudos to yoyo for pointing this out.

If you are scripting in C#, do a google search for Regular Expressions C# While it is a little complex in the beginning to understand, you can do all your checks with them.

You can count the amount of characters. If all names have Weapon in it you just need to check if there are more then 6 characters or not.