aboutsummaryrefslogtreecommitdiffstats
path: root/Source/SPTextView.m
diff options
context:
space:
mode:
Diffstat (limited to 'Source/SPTextView.m')
-rw-r--r--Source/SPTextView.m2
1 files changed, 1 insertions, 1 deletions
diff --git a/Source/SPTextView.m b/Source/SPTextView.m
index d16992e4..a1797521 100644
--- a/Source/SPTextView.m
+++ b/Source/SPTextView.m
@@ -776,7 +776,7 @@ NSInteger alphabeticSort(id string1, id string2, void *reverse)
// Check if found table name is known, if not parse for aliases
if(![allTables containsObject:[NSString stringWithFormat:@"%@%@%@", conID, SPUniqueSchemaDelimiter, tableName]]) {
NSString* currentQuery = [[self string] substringWithRange:[customQueryInstance currentQueryRange]];
- NSRange aliasRange = [currentQuery rangeOfRegex:[NSString stringWithFormat:@"(?i)\\s`?(\\S+?)`?\\s+(AS\\s+)?`?%@`?", tableName] capture:1L];
+ NSRange aliasRange = [currentQuery rangeOfRegex:[NSString stringWithFormat:@"(?i)\\s`?(\\S+?)`?\\s+(AS\\s+)?`?%@`?\\b", tableName] capture:1L];
if(aliasRange.length) {
NSString *alias = [[currentQuery substringWithRange:aliasRange] stringByReplacingOccurrencesOfString:@"``" withString:@"`"];
// If alias refers to db.table split it