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:

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

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


This page was dynamically generated by the web application development tool RADpage of H.E.I.
© 1996-2017 H.E.I. All Rights Reserved.



Homepage
Intro/Features
Component Guide
Programming
  Language Guide
  Language Ref.
    General Design
    Lexical Structure
    Expressions
    Objects
    Methods
    Classes
    heitml Tags
    heitml Functions
    Advanced Functions
      containsRE
      containsCaseRE
      createMatchArray
      fileio_chmod
      fileio_fclose
      fileio_feof
      fileio_fopen
      fileio_fread
      fileio_fwrite
      fileio_strerror
      indexRE
      indexCaseRE
      regexcomp
      regexexec
      request_string
      request_tuple
      substr
      substRE
      substallRE
      TuSearch
      TuSearchTuple
      TuSort
    Database Access
    Global Variables
    Form Fields
    Server Variables
    Sessions
    heitml Syntax
  Component Ref.
  Class Library
  User Components
  Tryout Form
  Tutorial
  New Features
  heitml 1
User Guide
FAQ
Mailinglist
Discussion Group
Services
Pricing/Register
Download
Frame
 
Contact
 
 
 
Search: