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

shader u_subj_u_pattern_ura (output vector cout = 0)
{
    string u_subj = "electric blue";
    int results_m [3];
    int results_s [3];

    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 (u_subj, "ham");         // should not match
    b =  regex_match (u_subj, "ue");  // should match
    c =  regex_match (u_subj, "$el");
    d =  regex_match (u_subj, "el[a-b]");
    e =  regex_match (u_subj, ".*tric");       // should match

    f =  regex_search (u_subj,results_s, "blue");
    h =  regex_match (u_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+j/u, (c+d+h/v+u), (e*f+g/v*u));
    }
}
