On this page:
awk
match:  start
match:  end
match:  substring
regexp-exec

 (require mzlib/awk)

syntax

(awk next-record-expr
     (record field-id ...)
     maybe-counter
     ((state-variable init-expr) ...)
     maybe-continue
  clause ...)
 
maybe-counter = 
  | id
     
maybe-continue = 
  | id
     
clause = (test body ...+)
  | (test => procedure-expr)
  | (/ regexp-str / (id-or-false ...+) body ...+)
  | (range excl-start-test excl-stop-test body ...+)
  | (:range incl-start-test excl-stop-test body ...+)
  | (range: excl-start-test incl-stop-test body ...+)
  | (:range: incl-start-test incl-stop-test body ...+)
  | (else body ...+)
  | (after body ...+)
     
test = integer
  | regexp-string
  | expr
     
excl-start-test = test
     
excl-stop-test = test
     
incl-start-test = test
     
incl-stop-test = test
     
id-or-false = id
  | #f
The awk macro from Scsh [Shivers06]. In addition to awk, the Scsh-compatible procedures match:start, match:end, match:substring, and regexp-exec are defined. These match: procedures must be used to extract match information in a regular expression clause when using the => form.

procedure

(match:start rec [which])  exact-nonnegative-integer?

  rec : ....
  which : exact-nonnegative-integer? = 0

procedure

(match:end rec [which])  exact-nonnegative-integer?

  rec : ....
  which : exact-nonnegative-integer? = 0

procedure

(match:substring rec [which])  string?

  rec : ....
  which : exact-nonnegative-integer? = 0
Extracts a start position, end position, or substring corresponding to a match. The first argument is the value supplied to the procedure after => in a awk clause or the result of regexp-exec.

procedure

(regexp-exec re s)  (or/c .... false/c)

  re : (or/c string? regexp?)
  s : string?
Matches a regexp to a string, returning a record compatible with match:start, etc.