Group Abstract Group Abstract

Message Boards Message Boards

0
|
5.7K Views
|
5 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Comparing string lists with partial match

Posted 4 years ago

I have two lists of file names, about 200-300 per list. (attached as text files below). The Intersection of the lists is smaller than expected, only around 50 or so; probably the result of appended version number updates.

What I seek is a list of file names that are nearly identical, but have version number updates. I can describe this more accurately as file names that match up to the first non-alphabetical character in the filename. In this case the set of 'alphabetical' characters I wish to allow for initial part of string match includes both dash and underscore.

How to approach parsing the names to address that notion?

Attachments:
5 Replies

Rohit's solution works well, another alternative is

Map[StringSplit[#, "." | DigitCharacter][[1]] &, modded]

splits the strings at the first digit or "." and grabs the first result.

Another option is pattern matching but that is a bit more complicated (but more powerful).

Regards,

Neil

POSTED BY: Neil Singer
Posted 4 years ago

Hi Jonathan,

Something like this?

extract[name_] :=  name // StringPosition[DigitCharacter | "."] // Part[#, 1, 1] & // 
  StringTake[name, # - 2] &

extract /@ modded
POSTED BY: Rohit Namjoshi

Yes, they are all used as modifications to the game Minecraft, available for download from the modding website CurseForge. Enigmatica is a curated collection of such mods that includes a mod I'm interested in, Ars Nouveau

With hundreds of mods loaded at a time compatibility is an issue, and this is one such case. My current collection ceased running when I added Ars Nouveau to it. So the hunt is on to discover which mod(s) present an incompatibility, and thus require me to choose from a mutually exclusive set.

This list of mods with different version numbers is a first step to making the collection I have also host the mod I want. My next step will be to temporarily disable the various mods from this list to find out where the incompatibility exists.

I'll be using a divide and conquer technique. I'll disable half the mods in the list of potential version clash issues, and then try to run the game

  • If the game runs, the conflict was in the disabled half of the list
  • If the game fails to run, the conflict remains in the enabled half

With this list of 58 items the process of trial and error should take about half a dozen tries. Additionally, the first pass of disabling the whole list of version differences will help me determine if the issue is a version mismatch.

Posted 4 years ago

Hi Jonathan,

So now I am curious. Are all of those jar files being used by a single application? I did not recognize the names so I googled and they appear to be related to Minecraft. Can you share what you are trying to do? Totally understand if you cannot or don't want to.

POSTED BY: Rohit Namjoshi

Hi Rohit,

Your function did the trick, thanks! Here's how I used it to extract a list of files with different version numbers appended to the end

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard