Delphi Regular Expression Syntax (2): or with duplicate
//| use, | yes or no var reg:tperlregex; begin Reg: = tperlregex.create (nil' codegear Delphi '; Reg. RegEx ' e| Delphi|0 '//used | notation '//return: Cod G ar 2 7 freeandnil (REG); End;
//+ use, + is repeat 1 or more var reg:tperlregex; begin Reg: = tperlregex.create (nil' a AA AAA AAAA ab ABB Abbba A yes a '; Reg. RegEx ' ab+ '//used A + notation, here is allowed after a 1 or more B'//return: A AA AAA aaaa a Yes A Freeandnil (reg); End;
//* use, * is repeated 0 or more var reg:tperlregex; begin Reg: = tperlregex.create (nil' a AA AAA AAAA ab ABB Abbba A yes a '; Reg. The RegEx ' ab* '//uses the * notation, here is allowed to have multiple or no B'//return after a: Yes Freeandnil (REG); End;
the use of//? is repeated 0 or 1 var reg:tperlregex; begin Reg: = tperlregex.create (nil' a AA AAA AAAA ab ABB Abbba A yes a '; Reg. RegEx ' a? ' //Use the? Mark "' //return: b bb bbb Yes Freeandnil (REG); End;
use <1> for//curly braces, specify number of repetitions var reg:tperlregex; begin Reg: = tperlregex.create (nil' a AA AAA AAAA ab ABB Abbba A yes a '; Reg. RegEx ' a{3} '//here specify repeat 3 times '//return: A AA a AB ABB Abbba a Yes a Freeandnil (reg ); End;
//Use of curly braces <2> var reg:tperlregex; begin Reg: = tperlregex.create (nil' a AA AAA AAAA ab ABB Abbba A yes a '; Reg. RegEx ' a{2,4} '//here Specify repeat 2-4 times '//return: A ab ABB Abbba a Yes a Freeandnil (r EG); End;
//Use of curly braces <3> var reg:tperlregex; begin Reg: = tperlregex.create (nil' a AA AAA AAAA ab ABB Abbba A yes a '; Reg. RegEx ' a{1,} '//n or more, here is 1 or more '//return: b bb bbb Yes Freeand Nil (REG); End; //above this {1,} and + are equivalent; //and {0,1} is equivalent; //{0,} and * are equivalent
Delphi Regular Expression Syntax (2): or with duplicate