/libwildmatch

Simple string matching with questionmark- and star-wildcard operator.

Primary LanguageRustMIT LicenseMIT

libwildmatch

A C library to Open a path or URL with the system-defined program.

Installation & Setup

1. Clone the repository

git clone https://github.com/thechampagne/libwildmatch.git

2. Navigate to the root

cd libwildmatch

3. Build the project

cargo build

Example

#include <assert.h>

int main()
{
  assert(wildmatch_matches("cat", "cat") != 0);
  assert(wildmatch_matches("*cat*", "dog_cat_dog") != 0);
  assert(wildmatch_matches("c?t", "cat") != 0);
  assert(wildmatch_matches("c?t", "cot") != 0);
  assert(wildmatch_matches("dog", "cat") == 0);
  assert(wildmatch_matches("*d", "cat") == 0);
  assert(wildmatch_matches("????", "cat") == 0);
  assert(wildmatch_matches("?", "cat") == 0);
  return 0;
}

References

License

This repo is released under the MIT.