match_simple
Description:
public static bool match_simple (string pattern, string str, RegexCompileFlags compile_options = 0, RegexMatchFlags match_options = 0)
Scans for a match in string
for pattern
.
This function is equivalent to match but it does not require to compile the pattern with Regex, avoiding some lines of code when you need just to do a match without extracting substrings, capture counts, and so on.
If this function is to be called on the same pattern
more than once, it's more efficient to compile the pattern once with
Regex and then use
match.
Example: Match, simple:
public int main (string[] args){
// Output: ``true``
bool tmp = Regex.match_simple ("s[ai]mple", "This is a simple sample.");
print ("%s\n", tmp.to_string ());
return 0;
}
valac --pkg glib-2.0 GLib.Regex.match_simple.vala
Parameters:
pattern |
the regular expression |
compile_options |
compile options for the regular expression, or 0 |
match_options |
match options, or 0 |
string |
the string to scan for matches |
Returns:
true if the string matched, false otherwise |