Add short-circuits for regex testing

This commit is contained in:
Jon Evans 2020-03-01 10:28:18 -05:00
parent cf15a1c493
commit 4b4952b09a
1 changed files with 6 additions and 0 deletions

View File

@ -408,6 +408,9 @@ bool SCH_CONNECTION::IsBusLabel( const wxString& aLabel )
bool SCH_CONNECTION::IsBusVectorLabel( const wxString& aLabel )
{
if( !aLabel.Contains( wxT( "[" ) ) )
return false;
try
{
return std::regex_match( std::string( aLabel.mb_str() ), bus_label_re );
@ -421,6 +424,9 @@ bool SCH_CONNECTION::IsBusVectorLabel( const wxString& aLabel )
bool SCH_CONNECTION::IsBusGroupLabel( const wxString& aLabel )
{
if( !aLabel.Contains( wxT( "{" ) ) )
return false;
try
{
return std::regex_match( std::string( aLabel.mb_str() ), bus_group_label_re );