This is a search engine friendly CGI program that outputs help documents.
The LufDoc (Live User Fed Documentation) comment system will be implemented soon.

PSP Help Doc Indexer System

(Version 1.4.1)


PSP - RegExp Unit Reference

Introduction

Constants

Types

RegExp Syntax

RegExp in PSP

Procedures and Functions:

Tips and Tricks

Examples:

  • PSP_ROOT/src/examples/regtest.pp

Introduction

    Regular expressions are pretty comfortable way of parsing string data. It is some kind of "text description language", describing text masks and performing matches. You can use them when you need a quick way to check if string matches a pattern, if you need to extract some parts of the string or if you want to replace some parts of it.

    Before learning about functions of this unit you should read about regular expressions syntax. There is original TRegExpr syntax manual here and then some notes about regular expressions in PSP.

Types

RegexpEntry = Pointer;
// RegExp entry struct pointer

RegexpResult = Pointer;
// Global match result pointer

StrArray = array of string;

Tips and Tricks

  • Regular expressions are very universal but very slow. For special tasks such as HTML parsing use manual string parsing algorithms and/or substrings.
  • Try to avoid parsing long strings. The longer input data is the slower regexp works.

PSP Help documents