← Back to Advanced VBScript on ASPPY
Lesson 3

String Handling and RegEx

Advanced VBScript on ASPPY · Created 2026-06-01 13:34:28

Manipulate text with built-in functions and Regular Expressions.

String Functions
Len(str), Left(str, n), Right(str, n)
Mid(str, s, n), InStr(str, sub)
Replace(str, a, b), LCase/UCase
Trim(str), Asc(str), Chr(code)
StrComp(a, b, vbTextCompare)

RegEx via New RegExp
Dim re : Set re = New RegExp
re.Pattern = '^[A-Z][a-z]+$'
re.IgnoreCase = True : re.Global = True
If re.Test(str) Then ...
Set matches = re.Execute(str)
For Each m In matches
Response.Write m.Value
Next
re.Replace(str, replacement)

Live Demo →