Delphi Regular Expression Syntax (5): Boundary
//\b Word boundaries var reg:tperlregex; begin Reg: = tperlregex.create (nil' Delphi Delphi2007 mydelphi '; Reg. RegEx ' \bdelphi\b '//front and back border '//return: Delphi2007 mydelphi Freeandnil ( REG); End;
//\b Word boundary: Left border var reg:tperlregex; begin Reg: = tperlregex.create (nil' Delphi Delphi2007 mydelphi '; Reg. RegEx ' \bdelphi '///left Border '//return: Mydelphi Freeandnil (reg); End;
//\b Word boundary: right Border var reg:tperlregex; begin Reg: = tperlregex.create (nil' Delphi Delphi2007 mydelphi '; Reg. RegEx ' delphi\b '//Right Border '//return: Delphi2007 My Freeandnil (reg); End;
//\b Non-word boundary var reg:tperlregex; begin Reg: = tperlregex.create (nil' Delphi MyDelphi2007 mydelphi '; Reg. RegEx ' \bdelphi\b '//Now only Delphi in MyDelphi2007 belongs to the non-word boundary '//Return: Delphi My mydelphi Freeandnil (reg); End;
//^ Beginning of the line var reg:tperlregex; begin Reg: = tperlregex.create (nil' Delphi Delphi2007 mydelphi '; Reg. RegEx ' ^del '//Matches Del ' at the beginning of theline'//return: Phi Delphi2007 Mydelphi Freeandnil ( REG); End;
//\a also marks the beginning of the line var reg:tperlregex; begin Reg: = tperlregex.create (nil' Delphi Delphi2007 mydelphi '; Reg. RegEx ' \adel '//match at the beginning of the line Del'//return: Phi Delphi2007 Mydelphi Freeandnil (reg); End;
//$ line End var reg:tperlregex; begin Reg: = tperlregex.create (nil' Delphi Delphi2007 mydelphi '; Reg. RegEx ' phi$ '//Match phi at end ofline'//return: Delphi Delphi2007 mydel Freeandnil ( REG); End;
//\z also marks the end of the line var reg:tperlregex; begin Reg: = tperlregex.create (nil' Delphi Delphi2007 mydelphi '; Reg. RegEx ' phi\z '//Match phi at end ofline'//return: Delphi Delphi2007 mydel Freeandnil (reg); End; //test, \z is case-insensitive; \a
Delphi Regular Expression Syntax (5): Boundary