// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
#include <iostream>

using namespace std;

#include <regexp.h>

bool match(const char *pat, const char *s)
{
    TRegexp *rx = new TRegexp(pat);
    size_t len = -1;
    rx->find(s, &len);
    return (len==strlen(s));
}

int main()
{
    cout << match("[a-z]ul", "jul") << endl;
    cout << match("[a-z]ul", "hjul") << endl;
    cout << match("g[a-z ]*ul", "jul") << endl;
    cout << match("g[a-z ]*ul", "god jul") << endl;
    return 0;
}
