expanded class REGULAR_EXPRESSION_BUILDER

All features

Regular expression building from various dialects. Some REGULAR_EXPRESSION object is build from a string describing a pattern. A regular expression is a pattern that is matched against a subject string.

See tutorial/regular_expression for usage.

Direct parents

non-conformant parents

ANY

Summary

exported features

Building REGULAR_EXPRESSION

options

Error informations

Internal

Details

convert_posix_pattern (p: STRING): REGULAR_EXPRESSION

Create some REGULAR_EXPRESSION from the pattern p according to Posix syntax. If p is not a valid regular expression according to Posix syntax, then Result is Void and last_error_message and last_error_message are set.

require

  • p /= Void

ensure

  • Result /= Void xor last_error_message /= Void
  • initialized: Result /= Void implies not Result.last_match_succeeded
  • substitution_cleared: Result /= Void implies not Result.substitution_pattern_ready

convert_perl_pattern (p: STRING): REGULAR_EXPRESSION

Create some REGULAR_EXPRESSION from the pattern p according to Perl syntax. If p is not a valid regular expression according to Perl syntax, then Result is Void and last_error_message and last_error_message are set.

require

  • p /= Void

ensure

  • Result /= Void xor last_error_message /= Void
  • initialized: Result /= Void implies not Result.last_match_succeeded
  • substitution_cleared: Result /= Void implies not Result.substitution_pattern_ready

is_case_insensitive: BOOLEAN

Is the match case insensitive? Default is False

is_case_sensitive: BOOLEAN

Is the match case sensitive? Default is True

set_case_sensitive

Set the match as case sensitive.

ensure

  • definition: is_case_insensitive = False and is_case_sensitive = True

set_case_insensitive

Set the match as case insensitive.

ensure

  • definition: is_case_insensitive = True and is_case_sensitive = False

does_any_match_newline: BOOLEAN

Does the "any character" mark match a newline? Default is False

set_any_match_newline

The "any character" mark will match a newline.

ensure

  • definition: does_any_match_newline = True

set_any_dont_match_newline

The "any character" mark will not match a newline.

ensure

  • definition: does_any_match_newline = False

does_match_line_boundary: BOOLEAN

Does the begin/end marks match line boundary? Default is False

does_match_text_boundary: BOOLEAN

Does the begin/end marks match text boundary? Default is True

ensure

  • definition: Result = not does_match_line_boundary

set_match_line_boundary

The begin/end marks will match line boundary.

ensure

  • definition: does_match_line_boundary = True and does_match_text_boundary = False

set_match_text_boundary

The begin/end marks will match text boundary.

ensure

  • definition: does_match_line_boundary = False and does_match_text_boundary = True

has_extended_ligibility: BOOLEAN

Is the extended ligibility active?

set_extended_ligibility

Activate extended ligibility.

ensure

  • definition: has_extended_ligibility = True

set_no_extended_ligibility

Desactivate extended ligibility.

ensure

  • definition: has_extended_ligibility = False

set_default_options

Set the default options

ensure

  • is_case_sensitive
  • not does_any_match_newline
  • does_match_text_boundary
  • not has_extended_ligibility

last_error_message: STRING

Used to report error during last creation attempt.

See also convert_perl_pattern, convert_posix_pattern.

last_error_position: INTEGER

Used to report error position during last creation attempt.

See also convert_perl_pattern, convert_posix_pattern.

posix_builder: POSIX_REGULAR_EXPRESSION_BUILDER

The builder for the POSIX syntax

perl5_builder: PERL5_REGULAR_EXPRESSION_BUILDER

The builder for the POSIX syntax

convert_backtracking_pattern (p: STRING, builder: BACKTRACKING_REGULAR_EXPRESSION_BUILDER): BACKTRACKING_REGULAR_EXPRESSION

Create some BACKTRACKING_REGULAR_EXPRESSION from the pattern p according to the syntax pased by the given 'builder'. If p is not a valid regular expression according the said syntax, then Result is Void and last_error_message and last_error_message are set.

require

  • p /= Void and builder /= Void

ensure

  • Result /= Void xor last_error_message /= Void
  • initialized: Result /= Void implies not Result.last_match_succeeded
  • substitution_cleared: Result /= Void implies not Result.substitution_pattern_ready