Create account / Log in

Regex help

Issues with the Vassal engine.

Moderators: uckelman, Tim M

Regex help

Postby marktb1961 » October 13th, 2020, 9:59 am

I am new to using Regular Expressions. However, I thought this simple one should work {Type=~"Terrain.*"} (in a GKC) but it wouldn't... so I replaced it with {Type=="Terrain" || Type=="TerrainHighlight"}, which does work.


I was working off the Wikipedia entry for Regular Expressions which informs that "*" is zero or more of the preceding character and "." is any character.

Can anyone advise me where I am going wrong ?

Thanks,

Mark
Platform used:
Vassal 3.4.10
MacOS Big Sur
iMac (27", mid-2020)
User avatar
marktb1961
 
Posts: 335
Joined: October 4th, 2018, 2:36 pm
Location: Liverpool, England

Re: Regex help

Postby LoadEffectiveAddress » October 21st, 2020, 9:02 am

As far as I can see, you're using the expression correctly. I tried the same thing in a basic new module and it worked (GKC to send ctrl-d to every item on the map matching my expression). I am using 3.4.2 though.

Maybe learning about regexes is the goal, but if not you could use {Type.startsWith("Terrain")} to achieve the same thing.
LoadEffectiveAddress
 
Posts: 6
Joined: August 14th, 2020, 11:28 pm

Re: Regex help

Postby marktb1961 » October 21st, 2020, 12:06 pm

LoadEffectiveAddress wrote:As far as I can see, you're using the expression correctly. I tried the same thing in a basic new module and it worked (GKC to send ctrl-d to every item on the map matching my expression). I am using 3.4.2 though.

Maybe learning about regexes is the goal, but if not you could use {Type.startsWith("Terrain")} to achieve the same thing.


Thanks for help and the tip. I can try that out as another check next time.
Platform used:
Vassal 3.4.10
MacOS Big Sur
iMac (27", mid-2020)
User avatar
marktb1961
 
Posts: 335
Joined: October 4th, 2018, 2:36 pm
Location: Liverpool, England


Return to Technical Support & Bugs

Who is online

Users browsing this forum: No registered users and 4 guests