在Delphi用vbscript的正则表达式

一.由于Delphi本身没有正则表达式单元,可以引用vbscript来使用正则表达式,步骤为
1.在project中单击Import Type Library,选中Microsoft VBScript Regular Expression 5.5(version 5.5)
2.单击"Create Unit"按钮,生成Unit单元

二.新建一工程,导入上面生成的单元(在uses中引用该单元)
新建一按钮,在其单击事件中写入
var
  reg:TRegExp;
  re:boolean;
begin
  reg:=TRegExp.Create(nil);
  reg.Pattern :='^$';
  re :=reg.Test('');
  if re then
    showmessage('1')
  else
    showmessage('2');
end;   
原文地址:https://www.cnblogs.com/djcsch2001/p/2035748.html