is_match_bytes
Mojo function 🡭
is_match_bytes
➕
➖
fn is_match_bytes(regexp: Span[SIMD[uint8, 1], origin], text: Span[SIMD[uint8, 1], origin]) -> Bool
Search for regexp anywhere in text and return true if it matches.
from testing import assert_true, assert_false
from ExtraMojo.regex.simple_re import is_match_bytes
var re = "^cat".as_bytes()
assert_true(is_match_bytes(re, "cats of a feather".as_bytes()))
assert_false(is_match_bytes(re, "bird cats of a cat".as_bytes()))
Args:
- regexp (
Span[SIMD[uint8, 1], origin]
): The regular expression to search with. - text (
Span[SIMD[uint8, 1], origin]
): The text to search.
Returns:
Bool
: True if the regexp
matches the text
.