I am a supporter of
St. Joseph's hospice.
 If you find this site useful or if it helped you, consider a small donation to
St. Joseph's, please.

Information on
St. Joseph's

JustGiving - Sponsor me now!

 

RegExp

"It pays to be obvious, especially if you have a reputation for subtlety." [Isaac Asimov]

A regular expression is a string that is used to describe or match a set of strings, according to certain syntax rules. Regular expressions can easily be used to describe complex string filters, to extract or to replace strings or parts of strings.

A tutorial: http://www.regenechsen.de/phpwcms/index.php?regex_englisch
A tester:   http://www.regex-tester.de/regex_en.html
A huge bunch of interesting examples: http://regexlib.com

A useful function which I found in the web:

'String replacement with Regular Expressions via vbscript.regexp
'Parameters:
'SourceString   String to look into
'Pattern        Search pattern
'ReplaceString  Replacement string, use $i for submatches, i=1,2,...
'IgnoreCase     Flag whether to ignore capitals
'GlobalReplace  Flag whether to replace all matches or only first one
'MultiLine      Flag whether ^ and $ match in each row
'
'Returns:       SourceString with replacement(s) if applicable
'
Function RegExpReplace(ByVal SourceString As String, _
    ByVal Pattern As String, ByVal ReplaceString As String, _
    Optional ByVal IgnoreCase As Boolean = False, _
    Optional ByVal GlobalReplace As Boolean = False, _
    Optional ByVal MultiLine As Boolean = False) As String
   
    Dim objRE As Object
   
    Set objRE = CreateObject("vbscript.regexp")
    objRE.Pattern = Pattern
    objRE.IgnoreCase = IgnoreCase
    objRE.Global = GlobalReplace
    objRE.MultiLine = MultiLine
    RegExpReplace = objRE.Replace(SourceString, ReplaceString)
    Set objRE = Nothing
End Function

Sulprobil   Get it done   Contact   Disclaimer   Download