filoaman Posted July 3, 2015 Share Posted July 3, 2015 Hello coders I have a text in a file in my server, it looks like this: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam congue quam dui, id pulvinar lacus congue et. Cras ac sollicitudin leo. Vestibulum et quam at dui imperdiet suscipit. Sed varius, lacus ac mattis finibus, lorem odio volutpat nibh, iaculis elementum tellus enim in quam. Duis eget magna et justo congue molestie. Pellentesque sit amet convallis erat. Ut dapibus ante lobortis fringilla porttitor. Mauris tincidunt tristique accumsan. Vivamus a vehicula ligula. Vivamus vestibulum tincidunt quam ornare gravida. Mauris suscipit ultrices viverra. Proin sed gravida nibh. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aliquam erat volutpat. I can extract every element of the text and assign it to an array, in order to reconstrut the text lates as it is. The only thing i can't extract is the line brake. Is there a way to extract line brakes from the text and add them to my array? Thank you in advance Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted July 3, 2015 Share Posted July 3, 2015 Is ths related to yesterdays post with the regex I gave? The regex I gave ignores all whitespace characters, this is how it able to return all the words, numbers and symbols from the text and puts them into an array. Can I ask why does your text need to be read into an array? Quote Link to comment Share on other sites More sharing options...
filoaman Posted July 3, 2015 Author Share Posted July 3, 2015 Hi Ch0cu3r Thank you for the interest Since i'm not an experince coder, the only way to handle and modify the original text, in arrange all his elemnts on an array. After your help yesterday, now my script works perfect and i'm able to do every modification i want! I just wonder if there was a way to add this "icing on the cake" for aesthetic reasons. In any case this is a script for personal use and if what i'm looking for is complex, or impossible i can live without this... For a moment i thougth to replace the "\n" of text with an html code spipet (something like "<br />") but every trick i try doesn't work... Quote Link to comment Share on other sites More sharing options...
scootstah Posted July 3, 2015 Share Posted July 3, 2015 For a moment i thougth to replace the "\n" of text with an html code spipet (something like "<br />") but every trick i try doesn't work... I'm not totally clear on what you're trying to do here. But if you simply want to convert newlines to <br/>, there is a function for that. Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted July 3, 2015 Share Posted July 3, 2015 Sorry, still not clear as to why you reading the text into an array. Could explain it again please? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.