MATLAB: Regexp question number two

regexp

I have no idea why this isn't working. I've read in several places that this should work, but it doesn't. I have a string like:
str = 'Hello\nMy name is Lucas';
and I wanted to use regexp to split at the new line character, so I have the following:
results = regexp(str, '\n', 'split');
but it doesn't split the string and just returns the original string. I just upgraded to 2012b. Thanks.

Best Answer

You need to escape the `\`
results = regexp(str, '\\n', 'split')