Try doubling the slashes?Quote from: "cormullion"
Feetfish! I thought I had tried that and it didn't work!
Code Select
> (find "\d+" "3432" 0) $0
0
"3432"
> (find "\D+" "XC3432" 0) $0
0
"XC"
But it does work. Thanks Cormullion!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
> (find "d+" "3432" 0) $0
nil
"433"
> (find "D+" "XC3432" 0) $0
nil
"433"
> (find "[0-9]+" "3432" 0) $0
0
"3432"
(gs:set-font 'main-canvas "Lucida Sans" 20 "plain")
(gs:draw-text 'T "Click to create a node..." 20 30 gs:white)
Java -jar ..guiserver.jar 47011 program.lsp
-> mouse-released MAIN:main-canvas MAIN:canvas-clicking true
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at sun.font.FontDesignMetrics$MetricsKey.init(Unknown Source)
at sun.font.FontDesignMetrics.getMetrics(Unknown Source)
at sun.swing.SwingUtilities2.getFontMetrics(Unknown Source)
at javax.swing.JComponent.getFontMetrics(Unknown Source)
at TextShape.hasPoint(TextShape.java:86)
at CanvasWidget$MyCanvas.getTagsFromPoint(CanvasWidget.java:675)
at CanvasWidget$MyCanvas.mouseReleased(CanvasWidget.java:754)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
if(guiserver.debug) System.out.println("-> " + command);
System.out.println("F> " + command); // F for forced... josh 2012-10-07
(println (string "set-trace System " flag "n"))
set-trace System true
(load (append (env "NEWLISPDIR") "/guiserver.lsp"))
(gs:init)
(gs:frame 'main 100 100 800 800 "Demo")
(gs:set-border-layout 'main)
(gs:canvas 'main-canvas)
(gs:set-background 'main-canvas gs:gray)
(gs:add-to 'main 'main-canvas "center")
(gs:set-visible 'main true)
;; This is the affected line:
(gs:mouse-released 'main-canvas 'canvas-clicking true)
(define (canvas-clicking x y)
(println (args))
(gs:draw-circle 'C x y 8 gs:red)
(gs:update)
)
(gs:listen)
(setq x 412)
(setq a '((name "Bob")
(age x)))
(lookup 'age a) -> 412
(setq a (list '(name "Bob")
(list 'age x)))
; ch2.lsp
; jrlf 2007-09-17
; Convert C .h header files to NewLisp import statements.
(context 'importer)
(setq whitespace " trn" ; Whitespace to ignore.
break '("#" ";" "(" ")") ; Characters to tokenize on.
)
(define (nocomment text)
"( text -- cleaned) Removes comments and newlines. A bit of a cheat."
(replace "/\*.+?\*/" (replace "[n|r]+" text " " 0) "" 0)
)
(define (tokenize text)
"( text -- (token...)) Break text up into tokens."
; XXX Doesn't deal with quotes properly yet.
(letn ((found '())
(hold "")
(quoting nil)
(cleaned (nocomment text))
)
(dotimes (x (length cleaned))
(letn ((c (cleaned x)))
(if (<= 0 (find c whitespace))
(begin
(if (not (null? hold))
(setq found (append found (list hold))
hold "")))
(<= 0 (find c break))
(begin
(if (not (null? hold))
(setq found (append found (list hold))
hold ""))
(setq found (append found (list c)))
)
(setq hold (string hold c))
)
)
)
found
)
)
(define (read filename namespace)
"( filename namespace -- code) Create library import code."
(tokenize (read-file filename))
)
(context MAIN)
(println (importer:read "SDL_image.h" 'IMG))
[/code]