Invalid regular expression

Asked by v4l3n 3b

Hello,
i don't know if this is a bug, or only my fault, so i will ask here before i make a bug report...
When I start KiCAD i get a lot
"Invalid regular expression '^.*\.gb[alops]$': brackets [] not balanced"
errors...

I have tried to make my own program with the same RegEx and mine worked fine. The error is in tree_project_frame.c at line 542:

        for( unsigned i = 0; i < m_Filters.size(); i++ )
        {
            if(reg.Compile( m_Filters[i], wxRE_ICASE ) == false)
                wxMessageBox(wxString::Format("Error Compile %s with File %s",m_Filters[i],aName));
            else
            {
                if( reg.Matches( aName ) )
                {
                    addFile = true;
                    if( i==0 )
                        isSchematic = true;
                    break;
                }
            }

        }
I've added a Message Box to check if the compile call fails, and it fails on the following expressions:
    wxT( "^.*\\.gb[alops]$" ), // Gerber back (or bottom) layer file
    wxT( "^.*\\.gt[alops]$" ), // Gerber front (or top) layer file
    wxT( "^.*\\.g[0-9]{1,2}$" ), // Gerber inner layer file

I compiled with wx2.9.2
KiCAD Working Tree 3545

I can't find any error...

Thanks in advance

Question information

Language:
English Edit question
Status:
Solved
For:
KiCad Edit question
Assignee:
No assignee Edit question
Solved by:
Wayne Stambaugh
Solved:
Last query:
Last reply:
Revision history for this message
Dick Hollenbeck (dickelbeck) said :
#1

On 05/07/2012 03:50 PM, v4l3n 3b wrote:
> New question #196398 on KiCad:
> https://answers.launchpad.net/kicad/+question/196398
>
> Hello,
> i don't know if this is a bug, or only my fault, so i will ask here before i make a bug report...
> When I start KiCAD i get a lot
> "Invalid regular expression '^.*\.gb[alops]$': brackets [] not balanced"
> errors...
>
> I have tried to make my own program with the same RegEx and mine worked fine. The error is in tree_project_frame.c at line 542:
>
> for( unsigned i = 0; i < m_Filters.size(); i++ )
> {
> if(reg.Compile( m_Filters[i], wxRE_ICASE ) == false)
> wxMessageBox(wxString::Format("Error Compile %s with File %s",m_Filters[i],aName));
> else
> {
> if( reg.Matches( aName ) )
> {
> addFile = true;
> if( i==0 )
> isSchematic = true;
> break;
> }
> }
>
> }
> I've added a Message Box to check if the compile call fails, and it fails on the following expressions:
> wxT( "^.*\\.gb[alops]$" ), // Gerber back (or bottom) layer file
> wxT( "^.*\\.gt[alops]$" ), // Gerber front (or top) layer file
> wxT( "^.*\\.g[0-9]{1,2}$" ), // Gerber inner layer file
>
> I compiled with wx2.9.2
> KiCAD Working Tree 3545
>
> I can't find any error...
>
> Thanks in advance

No idea. The expressions look fine. You may have to compile wx using debug options, and
then actually step into that code with a debugger.

Revision history for this message
Best Wayne Stambaugh (stambaughw) said :
#2

I just tested BZR r3551 on Windows with MinGW using wxWidgets 2.9.3 and I do not get the assertion when the regular expression was compiled. The files that matched the failing expressions you mentioned also showed up properly. You may want to get wxWidgets 2.9.3 a try.

Revision history for this message
v4l3n 3b (v4l3n3b) said :
#3

I updated also, and now it works. Thx.