Skip to content

Instantly share code, notes, and snippets.

@emmapersky
Created July 6, 2011 18:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emmapersky/1067947 to your computer and use it in GitHub Desktop.
Save emmapersky/1067947 to your computer and use it in GitHub Desktop.
Adding regular expression table matching to SeqelPro
Index: Source/SPTablesList.m
===================================================================
--- Source/SPTablesList.m (revision 3349)
+++ Source/SPTablesList.m (working copy)
@@ -1812,8 +1812,13 @@
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;
+
+ // Check the tables against the input as a regexp, and if no match, check for substring matches
+ NSPredicate *predicate = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", [listFilterField stringValue]];
+ if ([predicate evaluateWithObject:[tables objectAtIndex:i]] != YES) {
+ substringRange = [[tables objectAtIndex:i] rangeOfString:[listFilterField stringValue] options:NSCaseInsensitiveSearch];
+ if (substringRange.location == NSNotFound) continue;
+ }
// Add a title if necessary
if ((tableType == SPTableTypeTable || tableType == SPTableTypeView) && lastTableType == NSNotFound
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment