PreviousUpNext

14.2.38  Regular_Expression_Matcher

The standard library Regular_Expression_Matcher api defines access to regular expression matching over strings.

For historical reasons Mythryl has far more regular expression APIs and implementations than can really be justified, but this is the main one.

Implementations of the Regular_Expression_Matcher api may be generated via regular_expression_matcher_g from src/lib/regex/glue/regular-expression-matcher-g.pkg.

The library-standard implementation of the Regular_Expression api is provided by regex, which implements Perl-style regular expression matching.

The Regular_Expression_Matcher api source code is in src/lib/regex/glue/regular-expression-matcher.api.

See also: The regular expression tutorial.

The above information is manually maintained and may contain errors.

api {
    =~ : (String , String) -> Bool;
    find_first_match_to_ith_group : Int -> String -> String -> Null_Or(String );
    find_first_match_to_regex : String -> String -> Null_Or(String );
    find_first_match_to_regex_and_return_all_groups : String -> String -> Null_Or(List(String ) );
    find_all_matches_to_regex_and_return_values_of_ith_group : Int -> String -> String -> List(String );
        find_all_matches_to_regex_and_return_all_values_of_all_groups :
        String -> String -> List(List(String ) );
    find_all_matches_to_regex : String -> String -> List(String );
    matches : String -> String -> Bool;
    replace_first_via_fn : String -> (List(String ) -> String) -> String -> String;
    replace_all_via_fn : String -> (List(String ) -> String) -> String -> String;
    replace_first : String -> String -> String -> String;
    replace_all : String -> String -> String -> String;
    regex_case : String -> {cases:List(((String , (List(String ) -> X))) ), default:Void -> X} -> X;
    Compiled_Regular_Expression;
        compile :
        number_string::Reader((Char, X)) -> number_string::Reader((Compiled_Regular_Expression, X));
    compile_string : String -> Compiled_Regular_Expression;
        find :
            Compiled_Regular_Expression
            ->
            number_string::Reader((Char, X))
            ->number_string::Reader(
              (?.regex_match_result::Regex_Match_Result(Null_Or({match_length:Int, match_position:X} ) ), X));
        prefix :
            Compiled_Regular_Expression
            ->
            number_string::Reader((Char, X))
            ->number_string::Reader(
              (?.regex_match_result::Regex_Match_Result(Null_Or({match_length:Int, match_position:X} ) ), X));
        stream_match :
              List(
              ((    String ,
                    (?.regex_match_result::Regex_Match_Result(Null_Or({match_length:Int, match_position:Y} ) ) -> X)
              ))
               )
            ->
            number_string::Reader((Char, Y)) -> number_string::Reader((X, Y));};


Comments and suggestions to: bugs@mythryl.org

PreviousUpNext