Code: Select all
(gs:init)
(gs:frame 'Regex 200 200 400 300 "Regex")
(gs:panel 'MainPanel)
(gs:set-grid-layout 'MainPanel 3 2)
(gs:text-field 'string-input 'textfield-handler 1)
(gs:text-field 'regex-input 'textfield-handler 1)
(gs:text-field 'output 'gs:no-action 1)
(gs:add-to 'MainPanel 'string-input 'regex-input 'output )
(gs:add-to 'Regex 'MainPanel)
(gs:set-visible 'Regex true)
(define (textfield-handler id text)
(gs:get-text id 'gettextcallback-handler))
(define (gettextcallback-handler id text)
(set 'results '())
(cond
((= text nil)
(gs:no-action))
((= id "MAIN:regex-input")
(set 'rgx (base64-dec text)))
((= id "MAIN:string-input")
(set 'strng (base64-dec text)))
)
(catch
(replace rgx strng
(push (string {$1 } ($ 1)) results -1)
opt) 'error)
(gs:set-text 'output (string results)))
(set 'opt 0 'strng " " 'rgx " ")
(gs:listen)