Regular Expression Syntax

I’m trying to create a piece inventory of two separate zones (on different player hands) with the expression
CurrentZone=~“ConfCards”|“UnionCards” in the Show only pieces matching these properties field.

The expression builder gives me the green check, but I get an error when I try to load the inventory window:

  • Bad Data in Module: Expression evaluation error Expression={CurrentZone=~“ConfCards”|“UnionCards”}, Error= inline evaluation of: ``_xyzzy=_plugh();’’ internal Error: Unimplemented binary String operator

Any suggestions on what I am doing wrong?

Thanks,
Jeff

Try CurrentZone=~“ConfCards|UnionCards”, your regular expression should be just one string, you are ORing together 2 strings which is not defined.

Thanks Brent. That gets rid of the error message, but unfortunately nothing shows in the piece inventory.

With a simple expression such as that, you may also go with the original Vassal syntax as…

CurrentZone =~ $ConfCards$|$UnionCards$

I “think” that should work.

Thanks Dr. N, but I get the same error message when I try to load the window:

  • Bad Data in Module: Expression evaluation error Expression={CurrentZone=~ConfCards+"|"+UnionCards}, Error= inline evaluation of: ``_xyzzy=_plugh();’’ internal Error: Unimplemented binary String operator

Ok. Well, apparently that doesn’t work. But this should:

CurrentZone = $ConfCards$ || CurrentZone = $UnionCards$

That did it! Thanks Dr N!

Interestingly, I didn’t work when I loaded it in the Expression Builder dialogue (it added the curly brackes at the beginning and end), but worked when I loaded it directly in the field.

Yeah, the expression builder uses Beanshell (I think that’s the name of it) so it would naturally try to convert it. The expression I gave you is the old style built-in Vassal syntax.