EXSLT - regexp:replace - Version 1

Version: 1
Status: new
User Page: index.html
XML Definition: regexp.replace.xml
Function Package: regexp.replace.zip

Function Syntax

string regexp:replace(string, string, string, string)

The regexp:replace function replaces the parts of a string that match a regular expression with another string.

The first argument is the string to be matched and replaced. The second argument is a regular expression that follows the Javascript regular expression syntax. The fourth argument is the string to replace the matched parts of the string.

The third argument is a string consisting of character flags to be used by the match. If a character is present then that flag is true. The flags are:

  • g: global replace - all occurrences of the regular expression in the string are replaced. If this character is not present, then only the first occurrence of the regular expression is replaced.
  • i: case insensitive - the regular expression is treated as case insensitive. If this character is not present, then the regular expression is case sensitive.

An implementation of this extension function in the EXSLT regexp namespace must conform to the behaviour described in this document.


Built-in support for regexp:replace is available in the following XSLT processors:

ProcessorProcessor VersionImplemented Version
4XSLT, from 4Suite.0.12.0a31

The following implementations of regexp:replace are available:

LanguageImplemented VersionCreatorDateDownload
Javascript1Chris Bayes2001-06-24regexp.replace.js
Msxsl1Chris Bayes2001-06-24regexp.replace.msxsl.xsl

Use Cases

Use Case Package: regexp.replace.use-cases.zip

The following use cases illustrate the functionality of regexp:replace.

DetailsCalling StylesheetXML DataExpected ResultCategoryTemplate

Change History

Submitted: 2001-06-24
Creator: Chris Bayes(http://www.bayes.co.uk)

Replaces according to a regular expression.
1.12002-08-20Craig Stewart

Added 4XSLT implementation to the list.

1.22002-11-12Craig Stewart

Updated 4XSLT version to 0.12.0a3.

http://www.exslt.org/regexp/functions/replace/regexp.replace.1.html last modified 2002-11-12