Delphi Regular Expression Syntax (5) boundary

Source: Internet
Author: User
\b Word boundary var reg:tperlregex;
 
  BEGIN REG: = Tperlregex.create (nil); Reg. 
  Subject: = ' Delphi Delphi2007 mydelphi '; Reg. RegEx: = ' \bdelphi\b '; Front and rear border Reg.
  Replacement: = '; Reg.
 
  ReplaceAll; ShowMessage (Reg. Subject);
return: Delphi2007 mydelphi Freeandnil (reg);
 
End
\b Word boundary: left boundary var Reg:tperlregex;
 
  BEGIN REG: = Tperlregex.create (nil); Reg. 
  Subject: = ' Delphi Delphi2007 mydelphi '; Reg. RegEx: = ' \bdelphi '; Left bound Reg.
  Replacement: = '; Reg.
 
  ReplaceAll; ShowMessage (Reg. Subject);
Return: 2007 Mydelphi Freeandnil (REG);
 
End
\b Word boundary: right boundary var Reg:tperlregex;
 
  BEGIN REG: = Tperlregex.create (nil); Reg. 
  Subject: = ' Delphi Delphi2007 mydelphi '; Reg. RegEx: = ' delphi\b '; Right Border Reg.
  Replacement: = '; Reg.
 
  ReplaceAll; ShowMessage (Reg. Subject);
return: Delphi2007 my Freeandnil (reg);
 
End
\b Non-word boundary var Reg:tperlregex;
 
  BEGIN REG: = Tperlregex.create (nil); Reg.
  Subject: = ' Delphi MyDelphi2007 mydelphi '; Reg. REgex: = ' \bdelphi\b '; Now only the Delphi in MyDelphi2007 belongs to the non word boundary Reg.
  Replacement: = '; Reg.
 
  ReplaceAll; ShowMessage (Reg. Subject);
Back: Delphi My 2007 Mydelphi Freeandnil (REG);
 
End
^ Beginning of Var Reg:tperlregex;
 
  BEGIN REG: = Tperlregex.create (nil); Reg.
  Subject: = ' Delphi Delphi2007 mydelphi '; Reg. RegEx: = ' ^del '; Match the Del Reg at the beginning of the line.
  Replacement: = '; Reg.
 
  ReplaceAll; ShowMessage (Reg. Subject);
Back: Phi Delphi2007 Mydelphi Freeandnil (reg);
 
End
\a also marks the beginning of the Var Reg:tperlregex;
 
  BEGIN REG: = Tperlregex.create (nil); Reg.
  Subject: = ' Delphi Delphi2007 mydelphi '; Reg. RegEx: = ' \adel '; Match the Del Reg at the beginning of the line.
  Replacement: = '; Reg.
 
  ReplaceAll; ShowMessage (Reg. Subject);
Back: Phi Delphi2007 Mydelphi Freeandnil (reg);
 
End
$ line Tail//www.bianceng.cn var Reg:tperlregex;
 
  BEGIN REG: = Tperlregex.create (nil); Reg. 
  Subject: = ' Delphi Delphi2007 mydelphi '; Reg. RegEx: = ' phi$ '; Matches Phi Reg at the end of a line.
  Replacement: = '; Reg.
ReplaceAll; 
  ShowMessage (Reg. Subject);
Back: Delphi Delphi2007 mydel Freeandnil (reg);
 
End
\z also marks the line tail var Reg:tperlregex;
 
  BEGIN REG: = Tperlregex.create (nil); Reg.
  Subject: = ' Delphi Delphi2007 mydelphi '; Reg. RegEx: = ' phi\z '; Matches Phi Reg at the end of a line.
  Replacement: = '; Reg.
 
  ReplaceAll; ShowMessage (Reg. Subject);
Back: Delphi Delphi2007 mydel Freeandnil (reg);
 
End When testing, \z is not case-sensitive;
 \a Distinction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.