Jump to content
UBot Underground

Removing Carriage Returns with Regex


Recommended Posts

IS there a piece of regex that will remove all carriage returns in a file.

 

I have a series of text items that always scrape from a webpage like this:

 

 

text item 1

 

text item 2

 

text item 3

 

text item 4

 

what i want to have is a final list that looks like this:

 

 

text item 1

text item 2

text item 3

text item 4

 

 

I've tried adding the items to a list and using regext to remove the line breaks but I can't get it to work. I've also tried adding the entries to a new list and remove duplicates, but it looks like CARRIAGE returns are not considered duplicates. I've also tried sorting the list to, but that doesn't work.

 

Anyone got any good ideas?

Link to post
Share on other sites

You can do this without regex by searching for $newline and replacing it with $nothing.

 

If you have the Pro/Dev version. Please change your Profile info to reflect your version of UBot and your system environment.

 

Thanks

Link to post
Share on other sites
  • 2 months later...

You can also loop through it and do something like this:

 

If--->$text length($list item) = 0

 

Then---> remove list item

 

But for regex, the string for a carriage return is \r

 

John

Link to post
Share on other sites

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...