Problem 7: Extracting information from a log file

In this example, we are going to use actual output from an Android adb debugging session. Your goal is to use any regular expression techniques that we've learned so far to extract the filename, method name and line number of line of the stack trace (they follow the form "at package.class.methodname(filename:linenumber)").

Good luck!

Exercise 7: Extracting data from log entries
Task Text Capture Groups  
skip W/dalvikvm( 1553): threadid=1: uncaught exception To be completed
skip E/( 1553): FATAL EXCEPTION: main To be completed
skip E/( 1553): java.lang.StringIndexOutOfBoundsException To be completed
capture E/( 1553): at widget.List.makeView(ListView.java:1727) makeView ListView.java 1727 To be completed
capture E/( 1553): at widget.List.fillDown(ListView.java:652) fillDown ListView.java 652 To be completed
capture E/( 1553): at widget.List.fillFrom(ListView.java:709) fillFrom ListView.java 709 To be completed
Solution

This one can be tricky too, but we really just want to capture the method name, filename, and line number. This can be achieved using the expression (\w+)\(([\w.]+):(\d+)\) in which the first capture group is the method, followed by an escaped parenthesis, followed by the filename, a colon, and finally the line number.

Solve the above task to continue on to the next problem, or read the Solution.