RegEx
Class RegEx

Method PrototypeDescription
Sub Constructor()initialize the RegEx object
Function Options() As RegExOptionsget the options for this RegEx object
Sub Options(Assigns newOpts As RegExOptions)set new options for this RegEx object
Function Replace(s As String = "", startPos As Integer=0) As Stringreplace one or all matches
Function ReplacementPattern() As Stringget the replacement pattern
Sub ReplacementPattern(Assigns s As String)set the replacement pattern
Function Search(s As String = "", startPos As Integer=-1) As RegExMatchsearch for a match
Function SearchPattern() As Stringget the search pattern
Sub SearchPattern(Assigns s As String)set the search pattern
Function SearchStartPosition() As Integerget the search start position
Sub SearchStartPosition(Assigns i As Integer)get the search start position


This class represents a regular expression, which is a way of representing a pattern to search for within a string. It can be used just to find matching text, or to replace that text with new text (that may recombine portions of the matched text). By appropriately setting the RegExOptions on your RegEx object before using it, you can affect how the matching is done, and whether a single match or all matches are affected by the Replace call.

Regular expressions are a complex subject. Yuma's RegEx engine is compatible with PCRE, which is generally the same as in Perl. So you might see this perldoc page for a reference on regular expression syntax. Some text editors, such as TextWrangler, support regular expressions and have very good reference material in their manuals; this can be a great way to explore and construct the regular expression you need.