Derek Peirce
06/13/2025, 5:46 AMRegex("""java\.lang\.ArrayIndexOutOfBoundsException: Index \d+ out of bounds for length \d+""")
I could write:
Regex("java.lang.ArrayIndexOutOfBoundsException: ", RegexOption.LITERAL) + Regex("""Index \d+ out of bounds for length \d+""")
Riccardo Lippolis
06/13/2025, 6:37 AM\Qjava.lang.ArrayIndexOutOfBoundsException:\E Index \d+ out of bounds for length \d+
(everything between \Q
and \E
is escaped)
or alternatively you could use the Regex.escape
function, depending on your preference, like:
Regex("""${Regex.escape("java.lang.ArrayIndexOutOfBoundsException:")} Index \d+ out of bounds for length \d+""")
btw, also note that the index in an out of bounds exception could also be negative, so you'd need to account for e.g. an index of -1, unless you're specifically matching for positive indices :)Derek Peirce
06/13/2025, 6:43 AMCompanion
page for Regex
, and only looked at the main page.ephemient
06/13/2025, 12:36 PM