Jump to content

Recommended Posts

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

 

 

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?

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...

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.