Split by regex

This commit is contained in:
Jesse Boyd 2019-11-10 13:08:34 +00:00
parent 34eb7d05dc
commit 8c1985f9c0
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 3 additions and 3 deletions

View File

@ -1320,7 +1320,7 @@ import java.util.zip.ZipInputStream;
.filter(validArgument -> args.toLowerCase(Locale.ENGLISH).contains(validArgument)) .filter(validArgument -> args.toLowerCase(Locale.ENGLISH).contains(validArgument))
.count(); .count();
String[] split = args.toLowerCase(Locale.ENGLISH).split(","); String[] split = args.toLowerCase(Locale.ENGLISH).split(",(?![^\\(\\[]*[\\]\\)])");
if (split.length > expected) { if (split.length > expected) {
// This means we have multi-block block buckets // This means we have multi-block block buckets

View File

@ -66,7 +66,7 @@ public class Configuration {
return new BlockBucket(); return new BlockBucket();
} }
final BlockBucket blockBucket = new BlockBucket(); final BlockBucket blockBucket = new BlockBucket();
final String[] parts = string.split(","); final String[] parts = string.split(",(?![^\\(\\[]*[\\]\\)])");
for (final String part : parts) { for (final String part : parts) {
String block = part; String block = part;
int chance = -1; int chance = -1;
@ -99,7 +99,7 @@ public class Configuration {
if (string == null || string.isEmpty()) { if (string == null || string.isEmpty()) {
return false; return false;
} }
final String[] parts = string.split(","); final String[] parts = string.split(",(?![^\\(\\[]*[\\]\\)])");
for (final String part : parts) { for (final String part : parts) {
String block = part; String block = part;
if (part.contains(":")) { if (part.contains(":")) {