Delphi regular expression syntax (4): common escape characters and.

Source: Internet
Author: User
// \ D matches all numbers, which is equivalent to [0-9] var REG: tperlregex; begin REG: = tperlregex. create (NiL); Reg. subject: = 'expect Delphi 2008 for Win32! '; Reg. regEx: = '\ d'; Reg. replacement: = '◆ '; Reg. replaceall; showmessage (Reg. subject); // return: looking forward to Delphi ◆ for win ◆! Freeandnil (REG); end;
 // \ D matches all non-numbers, which is equivalent to [^ 0-9] var REG: tperlregex; begin REG: = tperlregex. create (NiL); Reg. subject: = 'expect Delphi 2008 for Win32! '; Reg. regEx: = '\ d'; Reg. replacement: = '◆ '; Reg. replaceall; showmessage (Reg. subject); // return: ◆ 2008 ◆ 32 ◆ freeandnil (REG); end;
 // \ W matches letters, numbers, and underscores (_), which are equivalent to [A-Za-z0-9 _] var REG: tperlregex; begin REG: = tperlregex. create (NiL); Reg. subject: = 'expect Delphi 2008 for Win32! '; Reg. regEx: = '\ W'; Reg. replacement: = '◆ '; Reg. replaceall; showmessage (Reg. subject); // return: Expected ◆! Freeandnil (REG); end;
 // \ W match non-letters, numbers and underscores _, equivalent to [^ A-Za-z0-9 _] var REG: tperlregex; begin REG: = tperlregex. create (NiL); Reg. subject: = 'expect Delphi 2008 for Win32! '; Reg. regEx: = '\ W'; Reg. replacement: = '◆ '; Reg. replaceall; showmessage (Reg. subject); // return: ◆ Delphi ◆ 2008 ◆ for ◆ Win32 ◆ freeandnil (REG); end;
 // \ S matches any blank spaces, including spaces, tabulation, and page feed. It is equivalent to [\ f \ n \ r \ t \ v] var REG: tperlregex; begin REG: = tperlregex. create (NiL); Reg. subject: = 'expect Delphi 2008 for Win32! '; Reg. regEx: = '\ s'; Reg. replacement: = '◆ '; Reg. replaceall; showmessage (Reg. subject); // return: Expected Delphi ◆ 2008 ◆ for ◆ Win32! Freeandnil (REG); end; {\ f: linefeed \ n: linefeed \ r: Carriage Return \ t: tab (Tab) \ V: vertical tab}
 // \ S matches any non-blank space, which is equivalent to [^ \ f \ n \ r \ t \ v] var REG: tperlregex; begin REG: = tperlregex. create (NiL); Reg. subject: = 'expect Delphi 2008 for Win32! '; Reg. regEx: = '\ s'; Reg. replacement: = '◆ '; Reg. replaceall; showmessage (Reg. subject); // return: ◆ freeandnil (REG); end;
 // \ X matches the hexadecimal asciivar REG: tperlregex; begin REG: = tperlregex. create (NiL); Reg. subject: = 'codegear Delphi '; Reg. regEx: = '\ x61'; // the ASCII value of A is 97, that is, the hexadecimal 61 Reg. replacement: = '◆ '; Reg. replaceall; showmessage (Reg. subject); // return: codege ◆ R Delphi freeandnil (REG); end; // unfortunately, tperlregex cannot use \ U or \ U to match Unicode characters!
 //. Match any character except the line break var REG: tperlregex; begin REG: = tperlregex. create (NiL); Reg. subject: = 'Expect '+ #10 + 'delphi 2008 for Win32! '; // #10 is the linefeed Reg. regEx: = '. '; Reg. replacement: = '◆ '; Reg. replaceall; showmessage (Reg. subject); {return result: ◆} freeandnil (REG ); end;
 

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.