Delphi Regular Expression Syntax (4) common escape characters and

Source: Internet
Author: User
Tags expression regular expression win32
\d matches all numbers, 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: Look forward to Delphi for Win!
Freeandnil (REG); 
End
\d matches all non-numeric, 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 Freeandnil (REG); 
End
\w matches 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);
  Back: Look!
Freeandnil (REG); 
End
\w matches 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, including space, tabulation, page change, etc., 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);
 
  Back: Look forward to Delphi 2008 for win32!
Freeandnil (REG);
 
End {\f: page break \ n: newline character \ r: Carriage return \ t: Tab \v: Vertical tab}//\s matches any non-white space, equivalent to [^\f\n\r\t\v]//www.bianceng.cn VA
R 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 hexadecimal ASCII var Reg:tperlregex;
 
  BEGIN REG: = Tperlregex.create (nil); Reg. Subject: = ' CodeGear Delphi'; Reg. RegEx: = ' \x61 '; The ASCII value of a is 97, which is the hexadecimal Reg.
  Replacement: = '; Reg.
 
  ReplaceAll; ShowMessage (Reg. Subject);
return: Codege R Delphi freeandnil (REG);
 
End 
I'm sorry Tperlregex can't match Unicode characters with \u or \u! // .
Matches any character other than a line break Var Reg:tperlregex;
 
  BEGIN REG: = Tperlregex.create (nil); Reg. Subject: = ' expect ' + #10 + ' Delphi 2008 for win32! '; #10是换行符 Reg.
  RegEx: = '. '; Reg.
  Replacement: = '; Reg.
 
  ReplaceAll; ShowMessage (Reg.
  Subject);
 
  {return:}
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.