Merge branch 2.1-stable into develop
diff --git a/system/database/DB_query_builder.php b/system/database/DB_query_builder.php
index 5d0a2ae..3b45bba 100644
--- a/system/database/DB_query_builder.php
+++ b/system/database/DB_query_builder.php
@@ -1985,7 +1985,7 @@
if (strpos($table, ' ') !== FALSE)
{
// if the alias is written with the AS keyword, remove it
- $table = preg_replace('/ AS /i', ' ', $table);
+ $table = preg_replace('/\s+AS\s+/i', ' ', $table);
// Grab the alias
$table = trim(strrchr($table, ' '));