Skip to content

Instantly share code, notes, and snippets.

@funrep
Created September 29, 2013 09:41
Show Gist options
  • Save funrep/6750974 to your computer and use it in GitHub Desktop.
Save funrep/6750974 to your computer and use it in GitHub Desktop.
Racket regexp fails.
(define (parse s)
(regexp-match #rx"^(?:[:](\S+) )?(\S+)(?: (?!:)(.+?))?(?: [:](.+))?$" s))
; regexp code taken from here http://mybuddymichael.com/writings/a-regular-expression-for-irc-messages.html
@funrep
Copy link
Author

funrep commented Sep 29, 2013

-> (regexp-match #rx"^(?:[:](\S+) )?(\S+)(?: (?!:)(.+?))?(?: [:](.+))?$" "PING :serve.net")
; readline-input:10:17: read: unknown escape sequence \S in string [,bt for
;   context]
#<procedure:+>
; readline-input:10:29: read: unexpected `)' [,bt for context]
; readline-input:10:31: read: unexpected `)' [,bt for context]
; ?: undefined;
;  cannot reference undefined identifier
; [,bt for context]
; S+: undefined;
;  cannot reference undefined identifier
; [,bt for context]
; ?:: undefined;
;  cannot reference undefined identifier
; [,bt for context]
; ?: undefined;
;  cannot reference undefined identifier
; [,bt for context]
; ?:: undefined;
;  cannot reference undefined identifier
; [,bt for context]
; ?$: undefined;
;  cannot reference undefined identifier
; [,bt for context]
" "
; PING: undefined;
;  cannot reference undefined identifier
; [,bt for context]
; :serve.net: undefined;
;  cannot reference undefined identifier
; [,bt for context]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment