The perlre Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The perlre Reference Manual

This is the perlre Reference Manual, version 0.5, generated automatically by Declt version 3.0 "Montgomery Scott" on Fri Jun 26 11:56:11 2020 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

perlre

Regular expression API using CL-PPCRE and CL-INTERPOL with operators known from sed or perl, m// and s/// plus a similar one, d// for split.

Can be useful for code brevity in regex heavy programs.

idea and code from Doug Hoyte's book Let Over Lambda and quicklisp-package let-over-lambda

Synopsis:

(#~s/regex/substitution/imsxge string)
(#~m/regex/[modifier] string)
(#~d/regex/[modifier] string) 

(ifmatch test then else)
(whenmatch test conseq*)
(match string clause*) ; a clause (test conseq) e.g (#~m/(regex)/ (list $1))

  Some examples:

  ; output of both is "h*a*nn*a*" 
  (let ((stg "hanna")
        (reg "(A)")
        (sub "*\\1*"))

    ; perlre
    (#~s/reg/sub/ig stg)

    ; cl-ppcre
    (ppcre:regex-replace-all (ppcre:create-scanner reg :case-insensitive-mode t) stg sub))
  



  ; -> 2
  (match "2012-11-04" 
    (#~m'abc' 1)
    (t 2))

  ;    HELLO
  ; -> 2016
  (match "2012-11-04" 
    (#~m'abc' 1)
    (#~m§(2012)-11-(04)§ (print 'hello) (+ (parse-integer $1) (parse-integer $2)))
    (t 2))

  ;"04/2012"
  (pre:match "2012-11-04"
    (#~m'abc' 1)
    (#~m§(\d{4})-.+-(..)§ (format nil "~a/~a" $2 $1))
    (t 2))

See test.lisp for other exampl


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 perlre

Author

<schatzer.johann@gmail>

License

BSD Simplified — the same as let-over-lambda

Description

s///, m//, d// - regular expression API for CL-PPCRE and CL-INTERPOL

Version

0.5

Dependencies
Source

perlre.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 perlre.asd

Location

perlre.asd

Systems

perlre (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 perlre/package.lisp

Parent

perlre (system)

Location

package.lisp

Packages

perlre


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 perlre/perlre.lisp

Dependency

package.lisp (file)

Parent

perlre (system)

Location

perlre.lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 perlre

Source

package.lisp (file)

Nickname

pre

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Macros

Macro: ifmatch (TEST O!S) CONSEQ &optional ALTERN
Package

perlre

Source

perlre.lisp (file)

Macro: match STG &body CLAUSES
Package

perlre

Source

perlre.lisp (file)

Macro: whenmatch (TEST S) &rest CONSEQ
Package

perlre

Source

perlre.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Macros

Macro: div O!A O!M
Package

perlre

Source

perlre.lisp (file)

Macro: mat O!A O!M
Package

perlre

Source

perlre.lisp (file)

Macro: sub O!A O!M
Package

perlre

Source

perlre.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: #~-reader S C N
Package

perlre

Source

perlre.lisp (file)

Function: mods S

modifiers: i m s x g e r and digits

Package

perlre

Source

perlre.lisp (file)

Function: segment-reader S C N

evaluation with / / delimiters, no evaluation with any other corresponding delimiter

Package

perlre

Source

perlre.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   P  
Index Entry  Section

F
File, Lisp, perlre.asd: The perlre․asd file
File, Lisp, perlre/package.lisp: The perlre/package․lisp file
File, Lisp, perlre/perlre.lisp: The perlre/perlre․lisp file

L
Lisp File, perlre.asd: The perlre․asd file
Lisp File, perlre/package.lisp: The perlre/package․lisp file
Lisp File, perlre/perlre.lisp: The perlre/perlre․lisp file

P
perlre.asd: The perlre․asd file
perlre/package.lisp: The perlre/package․lisp file
perlre/perlre.lisp: The perlre/perlre․lisp file

Jump to:   F   L   P  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   #  
D   F   I   M   S   W  
Index Entry  Section

#
#~-reader: Internal functions

D
div: Internal macros

F
Function, #~-reader: Internal functions
Function, mods: Internal functions
Function, segment-reader: Internal functions

I
ifmatch: Exported macros

M
Macro, div: Internal macros
Macro, ifmatch: Exported macros
Macro, mat: Internal macros
Macro, match: Exported macros
Macro, sub: Internal macros
Macro, whenmatch: Exported macros
mat: Internal macros
match: Exported macros
mods: Internal functions

S
segment-reader: Internal functions
sub: Internal macros

W
whenmatch: Exported macros

Jump to:   #  
D   F   I   M   S   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables


Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   P   S  
Index Entry  Section

P
Package, perlre: The perlre package
perlre: The perlre system
perlre: The perlre package

S
System, perlre: The perlre system

Jump to:   P   S