Unity-Scene-Query icon indicating copy to clipboard operation
Unity-Scene-Query copied to clipboard

Dot '.' is not recognized with regular expressions

Open Zenopheus opened this issue 8 years ago • 0 comments

If I query all game objects under a parent called "Foo" using: var xxx = root.SelectAll("Foo/?.*"); I get this exception: System.ApplicationException: Expected token: Name, but encountered token Dot (.)

It looks like '.' is being confused for a layer token. I hacked it to work by changing the layer token from '.' to '^'. It now works (until I need to use ^ in a regex). The code should probably not be looking for tokens once it encounters a '?'.

The code changes I made (not a solution):

QueryTokens.Dot --> QueryTokens.Caret
if (query[position] == '^')
{
  Token = QueryTokens.Caret;
  TokenString = "^";
  ++position;
  return;
}

By the way: This one of my favorite assets. People have no idea how powerful something like this can be. Thank you!

Zenopheus avatar Mar 05 '17 19:03 Zenopheus