I am trying to figure out a regex that could match results of a program that outputs in the smtlib format. Basically, my data is in the form:
(define-fun X_1 () Int
281)
(define-fun X_71 () Int
104)
(define-fun X_90 () Int
21)
(define-fun X_54 () Int
250)
etc.
Is it possible to write an expression that matches:
X_1 (...) 281
X_71 (...) 104
X_90 (...) 21
etc.
My current approach is to find individual occurences using \(define-fun[\w\s]+\)
, then for each occurence, remove (define-fun
, Int
, ()
and )
, and then read the data as all that's left is something like
1 281
, 71 104
I'm just wondering if there is a more elegant way of doing this?
Capture these substrings:
See regex proof.
EXPLANATION