if (0 == char_op_switch && !last_was_op)
{
last_was_op = 1;
- rx_exp = rand () % 3;
+ rx_exp = rand () % 4;
switch (rx_exp)
{
current_char = '*';
break;
case 2:
+ current_char = '?';
+ break;
+ case 3:
if (i < rx_length - 1) // '|' cannot be at the end
current_char = '|';
else
last_was_op = 0;
}
- if (current_char != '+' && current_char != '*' && current_char != '|')
+ if (current_char != '+' && current_char != '*' && current_char != '?' &&
+ current_char != '|')
{
*matching_strp = current_char;
matching_strp++;
int check_rand;
struct Regex_String_Pair rxstr[4] = {
+ {"ab?(abcd)?", 5,
+ {"ababcd", "abab", "aabcd", "a", "abb"},
+ {match, nomatch, match, match, nomatch}},
{"ab(c|d)+c*(a(b|c)d)+", 5,
{"abcdcdcdcdddddabd", "abcd", "abcddddddccccccccccccccccccccccccabdacdabd",
"abccccca", "abcdcdcdccdabdabd"},
{"abcdcdcdcdddddabd", "abcd", "abcddddddccccccccccccccccccccccccabdacdabd",
"abccccca", "abcdcdcdccdabdabd"},
{nomatch, nomatch, nomatch, nomatch, nomatch}},
- {"k|a+X*y+c|Q*e|p|R|Z*K*y*R+w|Y*6+n+h*k*w+V*F|W*B*e*g|N+V|t+L|P*j*3*9+X*h*J|J*6|b|E*i*f*R+S|Z|R|Y*Z|g*", 1,
- {"kaXycQepRZKyRwY6nhkwVFWBegNVtLPj39XhJJ6bEifRSZRYZg"},
- {nomatch}},
{"k|a+X*y+c|Q*e|p|R|Z*K*y*R+w|Y*6+n+h*k*w+V*F|W*B*e*g|N+V|t+L|P*j*3*9+X*h*J|J*6|b|E*i*f*R+S|Z|R|Y*Z|g*", 1,
{"kaXycQepRZKyRwY6nhkwVFWBegNVtLPj39XhJJ6bEifRSZRYZg"},
{nomatch}}