// Copyright Contributors to the Open Shading Language project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/AcademySoftwareFoundation/OpenShadingLanguage

shader v_subj_u_pattern_vra (output vector cout = 0)
{
    string v_subj = concat(format("%g", P[0]), " electric blue");

    //printf("%s", v_subj);
    int results_m[3] = {int(P[0]), int(P[0]), int(P[0])};
    int results_s[3] = {int(P[0]), int(P[0]), int(P[0])};
   
    int a = -1;
    int b = -1;
    int c = -1;
    int d = -1;
    int e = -1;
    int f = -1;
    int g = -1;
    int h = -1;
    int j = -1;

    a =  regex_match (v_subj, "ham");         // should not match
    b =  regex_match (v_subj, "ue");  // should match
    c =  regex_match (v_subj, "$el");
    d =  regex_match (v_subj, "el[a-b]");
    e =  regex_match (v_subj, ".*tric");       // should match
    f =  regex_search (v_subj,results_s, "blue");
    h =  regex_match (v_subj, results_m, "blue");

    for (int i = 0; i < 3; ++i) {
       g += results_m[i];
       j += results_s[i];
    }

    if( (a >=0) && (b>=0) && (c>=0) && (d>=0) && (e>=0) && 
        (f>=0) && (g>=0) && (h>=0) && (j>=0)) {
        cout = vector(a+b+h/u, (c+d+j/v+u), (e*f+g/v*u));
    }
}
