How to use command regex in this situation?

Actually I posted a question in stackoverflow?

Can any one give me some suggestion?

Thanks

Regular expression commands are not multi-line commands. So your approach of doing:

(lldb) command regex jspatch 's/(.+)/p (id)[JPEngine evaluateScript:@"%1"]/'

won't work with:

jspatch 'var a = 10
var b = 20
a = a + b'

because this will get executed as:

(lldb) jspatch 'var a = 10
(lldb) var b = 20
(lldb) a = a + b'

You can run this as:

(lldb) jspatch 'var a = 10; var b = 20; a = a+b;'

Can't you? Or you might be able to put newlines in as escaped sequences:

(lldb) jspatch 'var a = 10\nvar b = 20\na = a+b'

The best thing you can probably do is write this as a python command. See http://lldb.llvm.org/python-reference.html in the section named "CREATE A NEW LLDB COMMAND USING A PYTHON FUNCTION". This will allow you to make a new command line command that calls into a python module and runs the code. You can use the builtin "raw_input" command to fetch as many lines as you need and then run the expression from python as needed.