Need regex for nota
Moderators: Moderators, Lobby Developers, SPADS AutoHost
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Need regex for nota
modName:~NOTA\ d+\.\d+
Doesn't work. Nota's modname is currently "NOTA 1.88e"
I was trying to use the regex for evo as an example, but apparently that is fail. Halp?
Doesn't work. Nota's modname is currently "NOTA 1.88e"
I was trying to use the regex for evo as an example, but apparently that is fail. Halp?
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Need regex for nota
I'm lost, is this an issue with SPADS or are you just confused by regex?
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Need regex for nota
It's for an autohost. The regex always finds the latest version installed and sets that as the game version.
For example, evo uses this:
modName:~Evolution\ RTS\ \-\ v\d+\.\d+
@anarchid, no idea.
http://planetspads.free.fr/spads/doc/sp ... et:modName
For example, evo uses this:
modName:~Evolution\ RTS\ \-\ v\d+\.\d+
@anarchid, no idea.
http://planetspads.free.fr/spads/doc/sp ... et:modName
modName (hosting setting)
Explicit name Mod name
Description Name of the hosted mod (as returned by the GetPrimaryModName UnitSync function).
The corresponding mod must be available locally in the "games" or "packages" subdirectories of springDataDir.
It is also possible to use a regular expression instead of the exact mod name, by prefixing the value with "~". SPADS will then choose the latest mod in lexicographic order whose name match the regular expression, so it should automatically select the latest version of a given mod.
Format / Allowed values <modName> (<modName> must be the exact mod name, as returned by the GetPrimaryModName UnitSync function)
~<regularExpression> (at least one mod name must match the <regularExpression> regular expression)
Default value %modName% (set during installation, example: "~Balanced Annihilation V\d+\.\d+")
- Silentwings
- Posts: 3720
- Joined: 25 Oct 2008, 00:23
Re: Need regex for nota
Yes - are you saying that SPADS handles regex incorrectly, or are you just asking for help with regex?
If the latter, https://regex101.com/ is handy.
If the latter, https://regex101.com/ is handy.
Re: Need regex for nota
They're just Perl regex without anything fancy going on. SPADS does some minor magic to generate them based on the mod name given to it while setting up.
is broken for two reasons.
because of the 'e' on the end. \d stands for 'digit', so matches
If you'd like it to deal with the 'e' on the end, you can do something like this: which will match
This should be fine given the blurb higher up in the thread that SPADS uses lexical (alphabetic) ordering.
Code: Select all
NOTA\ d+\.\d+
- The first 'd' character class is separated from its backslash: should be \d+, not \ d+
- The second "\d+" does not match letters, like 'e'.
Code: Select all
NOTA 1.88e
Code: Select all
NOTA \d+\.\d+
Code: Select all
NOTA <one or more digits>.<one or more digits>
Code: Select all
NOTA \d+\.\w+
Code: Select all
NOTA <one or more digits>.<one or more word characters, which can be digits or letters>
Re: Need regex for nota
I thought that the "\ " is there to escape and match the space.Nemo wrote:They're just Perl regex without anything fancy going on. SPADS does some minor magic to generate them based on the mod name given to it while setting up..
- The first 'd' character class is separated from its backslash: should be \d+, not \ d+
Re: Need regex for nota
Jools: Not quite. Perl matches whitespace as literals by default:
The escape to match is only needed if you have the /x flag enabled on the regex (so you can embed spaces and comments in the pattern for better readability), but that's not the case in SPADS: https://github.com/Yaribz/SPADS/blob/ma ... ds.pl#L917.
In any case, 'd+' without the slash to introduce the character class is likely not what was intended, given the context of matching version numbers. "d+" means "one or more appearances of the letter 'd'" :)
Code: Select all
$ perl -E 'my $str = " foobar"; say $str =~ /^ \w+$/;'
1
In any case, 'd+' without the slash to introduce the character class is likely not what was intended, given the context of matching version numbers. "d+" means "one or more appearances of the letter 'd'" :)
Re: Need regex for nota
I have the same problem, for zero-k:
I'm using this regex:
It matches only, or maybe with first priority Zero-K v.1.3.9.0, whereas there is also Zero-K v.1.3.13.0
If I instead try with this regex (tested to match on http://www.regextester.com/)
Now it says
I'm using this regex:
Code: Select all
modName:~Zero-K\ v.+
If I instead try with this regex (tested to match on http://www.regextester.com/)
Code: Select all
modName:~Zero-K v.\d+.\d+.\d+.\d+
Unable to find mod matching "Zero-K v.\d+.\d+.\d+.\d+" regular expression
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Need regex for nota
Nemo, you are awesome. Thank you for making it so clear seems simple as hell now lol
Last edited by Forboding Angel on 27 Nov 2015, 23:43, edited 1 time in total.
Re: Need regex for nota
Was nemo though.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Need regex for nota
Oh derp, my mistake
Re: Need regex for nota
Where did you get these Zero-K packages from? As far as I know there is no dot between "v" and the version number in official Zero-K packagesJools wrote:It matches only, or maybe with first priority Zero-K v.1.3.9.0, whereas there is also Zero-K v.1.3.13.0
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Need regex for nota
Perhaps it would make more sense to just point out that he has an extra unnecessary dot in-between the v and the number than try to paint him as a fool who doesn't understand what he is doing.
Allow me to word it in a less aggressive tone...
@jools, in your examples, you are putting a dot inbetween the v and the number. Are you sure that that dot should be there? The reason I ask is that according to the packages here: http://zk.repo.springrts.com/builds/?C=M;O=D there isn't any dot there. Maybe that is the issue?
User was warned for this post; felony 1.
Please contain this petty dispute to a single thread. Better yet admit fault and just pack it in.
-- FLOZi
Allow me to word it in a less aggressive tone...
@jools, in your examples, you are putting a dot inbetween the v and the number. Are you sure that that dot should be there? The reason I ask is that according to the packages here: http://zk.repo.springrts.com/builds/?C=M;O=D there isn't any dot there. Maybe that is the issue?
User was warned for this post; felony 1.
Please contain this petty dispute to a single thread. Better yet admit fault and just pack it in.
-- FLOZi
Re: Need regex for nota
It seems your "extremely high reading comprehension level" is deficient, I never painted him as a fool. He said that his regex matches a package "Zero-K v.1.3.9.0" and that he also has a package "Zero-K v.1.3.13.0", I just trusted him that's all. I don't even know how Zero-K packages are generated and since official Zero-K hosts aren't connected to main Spring lobby anymore I can't even compare the names, hence my "As far as I know"... (the names shown here are just file names, not mod names as seen by unitsync and used by SPADS, so the version number formats aren't necessarily the same).Forboding Angel wrote:Perhaps it would make more sense to just point out that he has an extra unnecessary dot in-between the v and the number than try to paint him as a fool who doesn't understand what he is doing.
Re: Need regex for nota
Hmmm, it seems indeed that the dot would be the issue here. I didn't know the location of zk-repo so I could not open one archive and look at the real names. Now I managed to do that and I see that the official name is
However, I have that dot there before the v but it's supposed to match any character except line breaks, but it seems it needs to match the dot literally. I think it works if I remove that dot from the regex.
Code: Select all
Zero-K v1.3.11.3
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Need regex for nota
bibim wrote:...I never painted him as a fool.
bibim wrote:Where did you get these Zero-K packages from? As far as I know there is no dot between "v" and the version number in official Zero-K packages
Re: Need regex for nota
You can quote me as much as you want, even removing the parts where I explain why you are wrong, but it won't change the fact that you are wrong
Re: Need regex for nota
It still hosts Zero-K v1.3.9.0 instead of Zero-K v1.3.11.3, presumably because 9 comes before 1 numerally if you only consinder 1 digit after the period. I use this expression:
Code: Select all
modName:~Zero-K v\d+.\d+.\d+.\d+
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
Re: Need regex for nota
What the hell are you talking about anyway? One thing has nothing to do with the other... ffs.Flozi wrote:
User was warned for this post; felony 1.
Please contain this petty dispute to a single thread. Better yet admit fault and just pack it in.
-- FLOZi