Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

VerbalExpressions For Racket v0.1

Racket Regular Expressions made easy

  1. VerbalExpressions is Racket module that helps to construct difficult regular expressions. It is a port of VerbalExpressions.js located at

  2. Documentation for Racket regexp are here:

Arbitrary design decisions:

  1. To work with strings despite Perlism 34 []

  2. Use camelCase to match original library

  3. Return strings. This allows for extension to PERL syntax more easily in the future.

  4. Rename the VerbalExpression 'or to 'OR for expediency.

  5. Implement beginCapture, OR, matchCase, withAnyCase, as a higher node in the VerbalExpression tree [see example below]. These are macros and allow nesting. endCapture is also a macro to allow it to work inside let if needed [it isn't currently].

Other Implementations

You can see an up to date list of all ports in the organization.


Here's a couple of simple examples to give an idea of how VerbalExpressions works:

Testing if we have a valid URL

#lang racket
(require "verbal-expressions.rkt")
;; Create an example of how to test for correctly formed URLs
;; Note that idiomatic Verbal Expressions uses camelCase -
;; or at least that's what I have decided.
(define TESTER 
	(then "http")
	(maybe "s")
	(then "://")
	(maybe "www.")
	(anythingBut" ")

;; Create an example URL
(define TEST-ME "")

;; check the validity using
;; built-in regexp functions
(if (regexp-match? TESTER TEST-ME)
	"Valid URL"
	"Invalid URL: Do you need a call to  (wheelchair...)")

Replacing strings

;; Create a test string
> (define REPLACE-ME "Replace bird with a duck")

;; Create an expression that seeks for word "bird"
> (define BIRD
	(find "bird")

> ;; Execute the expression like a normal regexp object
> (regexp-replace BIRD REPLACE-ME "duck")
"Replace duck with a duck"

Example of OR

;; Other Macros similarly nested
>  (beginCapture
	(find "ab"))
		(find "C"))
>(pregexp (regex)) ;; (regex) returns the string
> (regexp-match* (pregexp (regex)) "ac ab")

Conversion to pregexp objects

Use (pregexp (regex)) to produce a PERL style syntax object [#prxstring]

Other implementations

You can view all implementations on


No description, website, or topics provided.







No releases published


No packages published