Delphi Regular Expression Syntax (7): Match escape character

Source: Internet
Author: User

Delphi Regular Expression Syntax (7): Match escape character
The meaning of the//? is to match 0-1 times, what if a match is needed? var reg:tperlregex;  begin Reg: = tperlregex.create (nil' How are you? ' OK! ') Reg. RegEx  ' \?|! ' ///Gar use of \ "'  //return: How are you, okay? Freeandnil (REG); End;
//random escape symbols \ Sometimes yes, but sometimes problems, better not to mess with var reg:tperlregex;  begin Reg: = tperlregex.create (nil' How are you? ' OK! ') Reg. RegEx  ' \?| \!| \ Good '//Give unnecessary! "and" good "added \ In this example also normal "//return: You're okay . Freeandnil (REG); End; {There would have been an option [Preextra] to prohibit the use of chaos, but the effect is not good}

Special character list in regular expressions:

Special characters Meaning in regular expressions Match the character itself
^ Matches the beginning of a string, or does not match the contents of [] \^
$ Match the end of a string \$
and Marker sub-expression \ (and \)
and Expressions that match "multi-character" \[and \]
and Symbol for number of matches \{and \}
. Match all characters except line break \.
? Match 0 or 1 times \?
+ Match at least 1 times \+
* Match 0 or more times \*
| Or \|
\ Escape symbol itself \\

Delphi Regular Expression Syntax (7): Match escape character

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.