BitVecRegexMatch

Table of Contents

BitVecRegexMatch

Description

Simple regex-style pattern matching for bitvectors. Supports basic patterns: ‘*’ (any sequence), ‘?’ (0 or 1), ‘[01]’ (literal).

Parameters

NameDirectionDescription
bvinBitvector to match against
patterninPattern 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)

    }
    
    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;

Share :

Related Posts

BitVecStartsWith

BitVecStartsWith Description Check if bitvector starts with the given bit pattern.

Read More

BitVecCountPattern

BitVecCountPattern Description Count total occurrences of a bit pattern in the bitvector.

Read More

BitVecFindLastPattern

BitVecFindLastPattern Description Find last occurrence of a bit pattern in the bitvector.

Read More