diff --git a/forge-core/src/main/java/forge/card/CardEdition.java b/forge-core/src/main/java/forge/card/CardEdition.java index e0bd3edefee..9706d607eb4 100644 --- a/forge-core/src/main/java/forge/card/CardEdition.java +++ b/forge-core/src/main/java/forge/card/CardEdition.java @@ -608,17 +608,30 @@ public final class CardEdition implements Comparable { it should also match the Un-set and older alternate art cards like Merseine from FEM. */ + /* Ideally we'd use the named group above, but Android *25* and + earlier doesn't appear to support named groups. + So, untill support for those devices is officially dropped, + we'll have to suffice with numbered groups. + We are looking for: + * cnum - grouping #1 + * rarity - grouping #2 + * name - grouping #3 + * artist name - grouping #4 + * extra parameters - grouping #5 + */ // Collector numbers now should allow hyphens for Planeswalker Championship Promos - "(?:^(?.?[0-9A-Z-]+\\S*[A-Z]*)\\s)?(?:(?[SCURML])\\s)?(?[^@$]*)(?: @(?[^$]*))?(?: \\$\\{(?.+)})?$" + "(?:^(.?[0-9A-Z-]+\\S*[A-Z]*)\\s)?(?:([SCURML])\\s)?(?[^@$]*)(?: @([^$]*))?(?: \\$\\{(.+)})?$" + //"(?:^(?.?[0-9A-Z-]+\\S*[A-Z]*)\\s)?(?:(?[SCURML])\\s)?(?[^@$]*)(?: @(?[^$]*))?(?: \\$\\{(?.+)})?$" ); public static final Pattern TOKEN_PATTERN = Pattern.compile( /* - * cnum - grouping #2 - * name - grouping #3 - * artist name - grouping #5 + * cnum - grouping #1 + * name - grouping #2 + * artist name - grouping #3 */ - "(?:^(?.?[0-9A-Z-]+\\S?[A-Z☇]*)\\s)?(?[^@]*)(?: @(?.*))?$" + //"(?:^(?.?[0-9A-Z-]+\\S?[A-Z☇]*)\\s)?(?[^@]*)(?: @(?.*))?$" + "(?:^(.?[0-9A-Z-]+\\S?[A-Z☇]*)\\s)?([^@]*)(?: @(.*))?$" ); public static final Pattern EXTRA_PARAMS_PATTERN = Pattern.compile( @@ -679,11 +692,11 @@ public final class CardEdition implements Comparable { continue; } - String collectorNumber = matcher.group("cnum"); - CardRarity r = CardRarity.smartValueOf(matcher.group("rarity")); - String cardName = matcher.group("name"); - String artistName = matcher.group("artist"); - String extraParamText = matcher.group("params"); + String collectorNumber = matcher.group(1); + CardRarity r = CardRarity.smartValueOf(matcher.group(2)); + String cardName = matcher.group(3); + String artistName = matcher.group(4); + String extraParamText = matcher.group(5); Map extraParams = null; if(!StringUtils.isBlank(extraParamText)) { Matcher paramMatcher = EXTRA_PARAMS_PATTERN.matcher(extraParamText); @@ -729,9 +742,9 @@ public final class CardEdition implements Comparable { continue; } - String collectorNumber = matcher.group("cnum"); - String cardName = matcher.group("name"); - String artistName = matcher.group("artist"); + String collectorNumber = matcher.group(1); + String cardName = matcher.group(2); + String artistName = matcher.group(3); // rarity isn't used for this anyway EditionEntry tis = new EditionEntry(cardName, collectorNumber, CardRarity.Token, artistName, null); tokenMap.put(cardName, tis); @@ -746,9 +759,9 @@ public final class CardEdition implements Comparable { if (!matcher.matches()) { continue; } - String collectorNumber = matcher.group("cnum"); - String cardName = matcher.group("name"); - String artistName = matcher.group("artist"); + String collectorNumber = matcher.group(1); + String cardName = matcher.group(2); + String artistName = matcher.group(3); EditionEntry tis = new EditionEntry(cardName, collectorNumber, CardRarity.Unknown, artistName, null); otherMap.put(cardName, tis); }