Fixed regular expression for int

Previous regular expression allowed numbers like "-1-1-4" and would throw exceptions during runtime.
This commit is contained in:
Alex Sokol 2023-02-18 00:43:50 +03:00 committed by GitHub
parent c48aa4f3c9
commit 9bc4ddd546
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -28,7 +28,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
public class Utilities { public class Utilities {
public static Pattern pattern = Pattern.compile("[\\-0-9]+"); public static Pattern pattern = Pattern.compile("-?[0-9]+");
public static SecureRandom random = new SecureRandom(); public static SecureRandom random = new SecureRandom();
public static Random fastRandom = new Xoroshiro128PlusRandom(random.nextLong()); public static Random fastRandom = new Xoroshiro128PlusRandom(random.nextLong());