Register to post in forums, or Log in to your existing account
 

 Related 
Contents
See also:
  Match
  Regular Expressions
  Regular Expression Options
  Replace
String Library
  Pos
  SubStr
  Len
  Replace
  Left
  Right
  Upper
  Lower
  Proper
  IntVal
  FloatVal
  Format
  Insert
  Delete
  Concat
  LeftBack
  RightBack
  Word
  NumWord
  DeleteNWord
  Begins
  Ends
  ASCII
  IsInt
  IsFloat
  RepeatStr
  Trim
  LTrim
  RTrim
  Explode
  Join
  Match
  RegReplace
  StripTags
  EncodeHTML
  DecodeHTML
  Reverse
  Compare
  HexStr
  HexVal
  QuoteSQL
  EncodeURL
  DecodeURL
  ExtractFileName
  ExtractFileExt
  ExtractPath
  Pad
  PadRight
  Center
  Soundex
  Wordwrap
  DecimalSeparator
  CaseSens
  QuoteChar
  Regular Expression Options
  Regular Expressions
  Split
  ExpandTabs
  md5
  ForceFileExt
  LoadFromFile
  SaveToFile
  cr
  lf
  crlf
Related Links:
  RegReplace
  Regular Expression Options
  Regular Expressions
RegReplace [[Str.RegReplace]] 
NOTE: This Design document is subject to change at any time.
RegReplace( RegExp: WideString; ReplaceStr: WideString; Source: WideString; [Options: WideString; Start: Integer]): WideString


Performs a regular expression match of the RegEx pattern in the Source string and then replaces the matched section with the ReplaceStr string. The match is performed beginning at the Start position in the Source string. If Start is omitted, the match is performed at the beginning of the Source string.

The ReplaceStr can contain the \1..\99 variables (also referenced with $1..$99 for compatibility) to insert substrings matched by patterns enclosed in () in the RegEx string.

The Options string can be used to set various regular expression options, including the 'e' option which will cause the resulting replacement string to be evaluated using the default scripting language before being returned. If Options is omitted, no additional options are applied.

For example:

str.RegReplace("(http://\w+(\.\w+)*/?)", "<a href=""\1"">\1</a>", Source, "a", 1)

would replace any URL in the source string with the HTML <A> tag turning it into a hyperlink. The "a" option causes ALL matches to be replaced instead of just replacing the first match found in the source string.
Viewer Comments [0 - Post your comments]

Jump to:  

© 2009 Zugg Software. Hosted by Wolfpaw.net