cobookman/gt-course-critique — pull request #30 by jonathantrevorh (2014-07-13 22:05:29+00:00)
Title: Handle search query without a space between dept and course #

Searching for "cs1331" should return the same results as "cs 1331". This preg_replace adds the space if it matches the former format.

Test of the regex:
```php
$queries = array(
'c',
'cs',
'cs1',
'cs123',
'cs 123',
'csasfsafas',
'math',
'loss',
'loss michael',
);

$regex = '/^([A-Za-z]*)(\d*)$/';
$replacement = '$1 $2';

foreach ($queries as $query) {
echo $query . ' -> ' . preg_replace($regex, $replacement, $query) . "\n";
}
```
Output:
```
$ php fuzzy.php
c -> c
cs -> cs
cs1 -> cs 1
cs123 -> cs 123
cs 123 -> cs 123
csasfsafas -> csasfsafas
math -> math
loss -> loss
loss michael -> loss michael
```