BitVecRegexMatch
- Function
- August 22, 2025
Table of Contents
BitVecRegexMatch
BitVecRegexMatch
Description
Simple regex-style pattern matching for bitvectors. Supports basic patterns: ‘*’ (any sequence), ‘?’ (0 or 1), ‘[01]’ (literal).
Parameters
Name | Direction | Description |
---|---|---|
bv | in | Bitvector to match against |
pattern | in | Pattern string using regex syntax |
Usage example (from documentation)
bool matches = BitVecRegexMatch(&data, "10*01"); // 10 followed by any bits, then 01
Usage example (Cross-references)
- In
BitVec.c:1587
:
}
bool BitVecRegexMatch(BitVec *bv, const char *pattern) {
ValidateBitVec(bv);
if (!pattern) {
bool test_bitvec_regex_match_null_source(void) {
printf("Testing BitVecRegexMatch(NULL, pattern) - should fatal\n");
BitVecRegexMatch(NULL, "101");
return true;
bool test_bitvec_regex_match_null_source(void) {
printf("Testing BitVecRegexMatch(NULL, pattern) - should fatal\n");
BitVecRegexMatch(NULL, "101");
return true;
}
bool test_bitvec_regex_match_null_pattern(void) {
printf("Testing BitVecRegexMatch(source, NULL) - should fatal\n");
BitVec source = BitVecInit();
BitVecPush(&source, true);
BitVec source = BitVecInit();
BitVecPush(&source, true);
BitVecRegexMatch(&source, NULL);
BitVecDeinit(&source);
return true;
// BitVecRegexMatch tests
bool test_bitvec_regex_match_basic(void) {
printf("Testing BitVecRegexMatch basic functionality\n");
BitVec source = BitVecInit();
// Test simple substring match
result = result && BitVecRegexMatch(&source, "101");
result = result && !BitVecRegexMatch(&source, "111");
// Test simple substring match
result = result && BitVecRegexMatch(&source, "101");
result = result && !BitVecRegexMatch(&source, "111");
BitVecDeinit(&source);
// BitVecRegexMatch tests
bool test_bitvec_regex_match_basic(void) {
printf("Testing BitVecRegexMatch basic functionality\n");
BitVec source = BitVecInit();
// Test simple substring match
result = result && BitVecRegexMatch(&source, "101");
result = result && !BitVecRegexMatch(&source, "111");
// Test simple substring match
result = result && BitVecRegexMatch(&source, "101");
result = result && !BitVecRegexMatch(&source, "111");
BitVecDeinit(&source);
bool test_bitvec_regex_match_null_source(void) {
printf("Testing BitVecRegexMatch(NULL, pattern) - should fatal\n");
BitVecRegexMatch(NULL, "101");
return true;
bool test_bitvec_regex_match_null_source(void) {
printf("Testing BitVecRegexMatch(NULL, pattern) - should fatal\n");
BitVecRegexMatch(NULL, "101");
return true;
}
bool test_bitvec_regex_match_null_pattern(void) {
printf("Testing BitVecRegexMatch(source, NULL) - should fatal\n");
BitVec source = BitVecInit();
BitVecPush(&source, true);
BitVec source = BitVecInit();
BitVecPush(&source, true);
BitVecRegexMatch(&source, NULL);
BitVecDeinit(&source);
return true;