About BRE and ERE, following a grammar definition Open Group released: BRE and Bracket Expression Grammar% token ORD_CHAR QUOTED_CHAR DUP_COUNT% token BACKREF L_ANCHOR R_ANCHOR% token Back_open_paren Back_close_paren / * '/ (' '/)' * /% token Back_open_brace Back_close_brace / * '/ {' '/}' * / / * The following tokens are for the Bracket Expression grammar common to both REs and EREs. * /% token COLL_ELEM META_CHAR% token Open_equal Equal_close Open_dot Dot_close Open_colon Colon_close / * '[=' ' =] '[.' '.]' '[:' ':]' * /% token class_name / * Class_name is a keyword to the lc_cType locale category * / / * (representing a character class) in the current local location * / / * and is only recognoded betWeen [: and:] * /% start basic_reg_exp %% / * ------------------------------------------------------------------------------------------------------------------------ -------------------------------------------------------------------------------------------------------------------- ------------- * / Basic_reg_exp: Re_expression | L_Anchor | R_Anchor | L_Anchor R_anchor | L_Anchor Re_Expression | RE_EXPRESSION R_ANAR | L_ANACHOR RE_EXPRESSION R_ANANACHOR; RE_EXPIPRESSION: SIMPLE_RE | RE_expression simple_RE; simple_RE: nondupl_RE | nondupl_RE RE_dupl_symbol; nondupl_RE: one_character_RE | Back_open_paren RE_expression Back_close_paren | Back_open_paren Back_close_paren | BACKREF; one_character_RE: ORD_CHAR | QUOTED_CHAR | bracket_expression; RE_dupl_symbol | '.': '*' | Back_open_brace DUP_COUNT Back_close_brace | Back_open_brace DUP_COUNT ',' Back_close_brace | back_open_brace dup_count ',' DUP_COUNT BACK_CLOSE_BRACE; / * ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------- Bracket Expression ------------------------------------------------------------------------------------------------------------------------------------------------ - * / bracket_expression: '[' matching_list ']'
| '[' Nonmatching_list ']'; matching_list: bracket_list; nonmatching_list: '^' bracket_list; bracket_list: follow_list | follow_list '-'; follow_list: expression_term | follow_list expression_term; expression_term: single_expression | range_expression; single_expression: end_range | character_class | equivalence_class; range_expression: start_range end_range | start_range '-'; start_range: end_range '-'; end_range: COLL_ELEM | collating_symbol; collating_symbol: Open_dot COLL_ELEM Dot_close | Open_dot META_CHAR Dot_close; equivalence_class: Open_equal COLL_ELEM Equal_close; character_class: Open_colon class_name Colon_close; / * --- ----------------------------------------- Extended Regular Expression ------ ------------------------------------- * / extended_reg_exp: ERE_BRANCH | EXTENDED_REG_EXP '|' ERE_BRANCH; ERE_BRANCH: ERE_EXPRESSION | ERE_BRANCH ERE_EXPIPRESSION; ERE_EXPIRESSION: One_Character_Re | '^' | '$' | '(' Extended_Reg_exp ')' | ERE_EXPRESSION ERE _dupl_symbol; one_character_ERE: ORD_CHAR | QUOTED_CHAR | bracket_expression; ERE_dupl_symbol | '.': '?' | | '*' | ' ' '{' DUP_COUNT '}' | '{' DUP_COUNT ',' '}' | '{' Dup_count ',' DUP_COUNT '}'; you can see several differences from BRE and ERE: 1. Special characters (i.e., means that the ordinary characters remain in the remaining special characters are not exactly the same) BRE:. [/ State, In addition to using in parentheses, the left brackets and anti-lascence should be special. The expression contains '[', and the front of the '[' does not have a backslash line and is not part of the parentheses. * The asterisk should be special, unless used in: a) Braces express B) The first character of the entire BRE (if there is a '^', after it) c) the first one of the child expression Character (if there is a '^'