]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/regex.cpp
applied patch 432814: saving BMP in 1, 4 and 8 bpp
[wxWidgets.git] / src / common / regex.cpp
index 46eb372cfb48d852bd2b6e95989c1d1c3639a84b..db11e97cec0cde16f08437dc22cda8cc67aa8198 100644 (file)
     #include "wx/intl.h"
 #endif //WX_PRECOMP
 
+// FreeBSD requires this, it probably doesn't hurt for others
+#ifdef __UNIX__
+    #include <sys/types.h>
+#endif
+
 #include <regex.h>
 
 #include "wx/regex.h"
@@ -313,7 +318,17 @@ int wxRegExImpl::Replace(wxString *text,
                     size_t start, len;
                     if ( !GetMatch(&start, &len, index) )
                     {
-                        wxFAIL_MSG( _T("invalid back reference") );
+                        // we can't do it because GetMatch() returns FALSE
+                        // even for a valid back reference index if it didn't
+                        // match for this expression (e.g. it when alternative
+                        // branches were used and the one contained the back
+                        // ref didn't match)
+                        //
+                        // it would be better to distinguish between this case
+                        // and really invalid index, but I don't know how to
+                        // do it
+
+                        //wxFAIL_MSG( _T("invalid back reference") );
 
                         // just eat it...
                     }