I would like to find all comment blocks(/*…*/) but the function g_regex_match_full always returns true.
Here is the code :
// Create the regex.
start_block_comment_regex = g_regex_new("/\*.*\*/", G_REGEX_OPTIMIZE, 0, ®ex_error);
//Search the regex;
if(TRUE == g_regex_match_full(start_block_comment_regex, current_line, -1, 0, 0, &match_info, ®ex_error))
{
}
You’re not using the pattern you think you are. You have to escape backslashes in strings in C:
I’m surprised you don’t get compiler warnings about “undefined escape sequence
\*” from your current code. I’m also surprised you didn’t get errors from glib there – the pattern you effectively used was probably/*.**/, which doesn’t make much sense. (Did you check regex_error? Obviously didn’t if that’s the full code…)