| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (7 out of 11)

Text Functions Using Regular Expressions

G2 provides various system-defined functions that find and/or replace text as designated by numeric arguments and regular expressions. For brevity, the names of such functions call a regular expression a pattern.

Text functions in general are described under G2 Text Manipulation Functions and G2 Conventions for Manipulating Text. G2 functions in general are described in Chapter 25, Functions.

Locating a Substring Using a Regular Expression

find-next-pattern 
(search-pattern: text, source-text: text, start-position: integer)
-> structure (start-index: integer, end-index: integer)

Extracting a Substring Using a Regular Expression

find-next-substring-matching-pattern 
(search-pattern: text, source-text: text, start-position: integer)
-> substring: text

Replacing a Substring Using a Regular Expression

find-and-replace-pattern 
(
search-pattern: text, text-to-substitute: text, source-text: text,
start-position: integer, end-position: integer)
-> modified-text: text
| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (7 out of 11)

Copyright © 1997 Gensym Corporation, Inc.