Textpad regex is pretty frustrating when you need to match parentheses, as both (
-)
and \(
-\)
make matching groups. (Very old versions of Textpad had only \(
-\)
as capturing markers, as unslashed parentheses were not "special".)
You can get around this by using a character class with one item, the relevant parenthesis. For example, when there's an error in java, a stack trace appears that looks in part like this:
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at day11$boardWrapper.toString(day11.java:85)
When running code through Textpad, you need a regex to catch the filename and line number. The pattern below captures those in \1 and \2, respectively, allowing me to configure the tool to let me jump directly to the offending line.
at.+[(]([^:]+):([0-9]+)[)]
at.+ offending function name
[(] (
( ) capturing group 1
[^:]+ anything not a colon (i.e., the filename)
: colon
( ) capturing group 2
[0-9]+ digits (line number)
[)] )