Regular expression not working

According to the design guide, this should be a valid expression:

{GetProperty(“Token 1_Level”)=~1|3|5|7|9}

But I only get this:

  • Bad Data in Module: Expression evaluation error Expression={GetProperty(“Token 1_Level”)=~1|3|5|7|9}, Error= inline evaluation of: ``_xyzzy=_plugh();’’ internal Error: Unimplemented binary integer operator

Weird, huh?

I just want to check if Token 1_Level is equal to any one of 1,3,5,7, and 9.

This seems to work:

GetProperty(“Token 1_Level”)==1||GetProperty(“Token 1_Level”)==3||GetProperty(“Token 1_Level”)==5||GetProperty(“Token 1_Level”)==7||GetProperty(“Token 1_Level”)==9||

But quite cumbersome, no?

Regular Expressions work on Strings, so the correct syntax is

{GetProperty(“Token 1_Level”)=~“1|3|5|7|9”}

In your version, the expression evaluator is trying to evaluate 1|3 and
not making any sense of it.

Rgds.

On 3/09/2016 6:56 PM, greenknight wrote:

According to the design guide, this should be a valid expression:

{GetProperty(“Token 1_Level”)=~1|3|5|7|9}

But I only get this:

  • Bad Data in Module: Expression evaluation error
    Expression={GetProperty(“Token 1_Level”)=~1|3|5|7|9}, Error= inline
    evaluation of: ``_xyzzy=_plugh();‘’ internal Error: Unimplemented binary
    integer operator

Weird, huh?

I just want to check if Token 1_Level is equal to any one of 1,3,5,7,
and 9.


Read this topic online here:
Regular expression not working


messages mailing list
messages@vassalengine.org
vassalengine.org/mailman/listinfo/messages


No virus found in this message.
Checked by AVG - www.avg.com
Version: 2016.0.7752 / Virus Database: 4649/12935 - Release Date:
09/03/16


Brent Easton
Analyst/Programmer
Western Sydney University
Email: b.easton@exemail.com.au

So simple…

Thanks!

Oddly enough I get the exact same error message when trying this solution.

Hmmm, on close examination of the source code, it appears that the =~ has not actually been implemented. This comes as a bit of a surprise to me as I wrote that part of Vassal. Mea culpa. Amazing that no one else has picked it up before. I will submit a fix for this shortly, but in the meantime you will need to use your extended syntax.

Not that you do not need to use the GetProperty function if you are not dynamically generating the property name. Just use the property name, no quotes, so the following would work:

Token 1_Level==1||Token 1_Level==3||Token 1_Level==5||Token 1_Level==7||Token 1_Level==9

Hi Brent,
I know this bug but in the past I could realized all my modules with the old syntax.
But, a fix is very good. :smiley: