% Input:
% string: String
% expression: String (regular expression)

% Output:
% lines: cell array of strings

% Description:
% Deletes blanks and linebreaks from string and splits the string at the
% regular expression "expression"

function [lines] = splitInput(string,expression)

%delete blanks and empty lines
newstring = '';
for i=1:1:length(string)
    if string(i) == ' ' || strcmp(string(i), sprintf('\n'))
    else
        if ~isempty(newstring)
            newstring(length(newstring)+1) = string(i);
        else
            newstring = string(i);
        end;
    end;
end;
string = newstring;

% splitting operation
lines = regexp(string,expression,'split');