How do I search for a string in a text file that has carriage returns within the string

2 views (last 30 days)
I have a text file I am trying to locate strings. Lets say that the txt file looked like this:
When I search for the string 'hello world' the above txt file would yield 0 results. How can I go about getting a result for this instead of it being overlooked?
Thank you for the help. Will

Sign in to comment.

Accepted Answer

Will Kinsman
Will Kinsman on 5 Dec 2015
str = regexprep(str,'\r\n|\n|\r',' ') or strtrim to remove formatting from the string and THEN doing a string search solves this issue

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!