aboutsummaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorrowanbeentje <rowan@beent.je>2011-07-12 00:00:57 +0000
committerrowanbeentje <rowan@beent.je>2011-07-12 00:00:57 +0000
commit56dfd953fc8c4e59b2d9ddbce2cc7f89d13ac0f3 (patch)
tree0be61e7177240412c46d35adbce22976f2709cda /Source
parentfa36e8280a3e3b02bbb39c152bd08061b302f168 (diff)
downloadsequelpro-56dfd953fc8c4e59b2d9ddbce2cc7f89d13ac0f3.tar.gz
sequelpro-56dfd953fc8c4e59b2d9ddbce2cc7f89d13ac0f3.tar.bz2
sequelpro-56dfd953fc8c4e59b2d9ddbce2cc7f89d13ac0f3.zip
- Support regex within the table filter list to match tables, falling back to plain text matching; thanks to Emma Persky for the original patch
Diffstat (limited to 'Source')
-rw-r--r--Source/SPTablesList.m9
1 files changed, 7 insertions, 2 deletions
diff --git a/Source/SPTablesList.m b/Source/SPTablesList.m
index d2d9f494..6cbf5f82 100644
--- a/Source/SPTablesList.m
+++ b/Source/SPTablesList.m
@@ -1809,11 +1809,16 @@ static NSString *SPDuplicateTable = @"SPDuplicateTable";
NSUInteger i;
NSInteger lastTableType = NSNotFound, tableType;
NSRange substringRange;
+ NSString *filterString = [listFilterField stringValue];
for (i = 0; i < [tables count]; i++) {
tableType = [[tableTypes objectAtIndex:i] integerValue];
if (tableType == SPTableTypeNone) continue;
- substringRange = [[tables objectAtIndex:i] rangeOfString:[listFilterField stringValue] options:NSCaseInsensitiveSearch];
- if (substringRange.location == NSNotFound) continue;
+
+ // First check the table name against the string as a regex, falling back to direct string match
+ if (![[tables objectAtIndex:i] isMatchedByRegex:filterString]) {
+ substringRange = [[tables objectAtIndex:i] rangeOfString:filterString options:NSCaseInsensitiveSearch];
+ if (substringRange.location == NSNotFound) continue;
+ }
// Add a title if necessary
if ((tableType == SPTableTypeTable || tableType == SPTableTypeView) && lastTableType == NSNotFound)