Contact | Privacy | Datenschutzerklärung | Impressum

substRE, substallRE

Format: substRE ( string, pattern, replacement )
Format: substallRE ( string, pattern, replacement )

Purpose: Substitutes regular expression patterns in a string by other strings. All three arguments must be strings. substRE() replaces the first occurrence of the pattern specified by the pattern parameter in string by the replacement parameter.

The substallRE() function works the same, except that it replaces all occurrences of the pattern.

Return Values: Returns the string with the replacements.

Example 1:

heitml input:resulting output:
<? substRE("Hello World ??!","[[:punct:]]",".")>Hello World .?!
<? substallRE("Hello World ??!","[[:punct:]]","!")>Hello World !!!
<? substallRE("Hello World ??!","^.*?o(.*)d.*$","$1")> Worl
<? substallRE("First,Next,Last", "(?x: ^([^,]*) \, ([^,]*) \, ([^,]*) $)", "$3,$2,$1");>Last,Next,First
<? substallRE("<h1>The h1-Tag and the h2-Tag</h1>", "(?x: h(\\d))", "H$1");><H1>The H1-Tag and the H2-Tag</H1>
<? substallRE("<h1>The h1-Tag and the h2-Tag</h1>", "(?x: h((1)|(2)) )()", "H$2$3");><H1>The H1-Tag and the H2-Tag</H1>

Example 2:

<let a="v   w  x    y      z"; b=" +"; c=",";
 ? d
resulting output:

See Also: subst(), substall(), indexRE(), regexcomp(), regexexec()

This page was dynamically generated by the web application development tool RADpage of H.E.I. See "Was ist AJAX? " (in German). In Germany H.E.I. provides Webdesign in Mannheim and Web Programming (Programmierung).
© 1996-2018 H.E.I. All Rights Reserved.

Component Guide
  Language Guide
  Language Ref.
    General Design
    Lexical Structure
    heitml Tags
    heitml Functions
    Advanced Functions
    Database Access
    Global Variables
    Form Fields
    Server Variables
    heitml Syntax
  Component Ref.
  Class Library
  User Components
  New Features
  heitml 1
User Guide
Contact / Impressum