Jump to content
UBot Underground

Expression To Delete Everything In Txt From X To Y ?


Recommended Posts

I have a load of txt logs and it comes with some standard bumf at the top like headers but they are not actually headers.

The first word of the doc always starts with "Start" and I want to delete everything inbetween to the word "Status:"  including "Status:"

How would I do that in ubot ?

 

many thanks :)

 

Link to post
Share on other sites

Hi Nick , that didn't work for some reason :(

 

Heres my code

 

set(#replaceTitle,$replace regular expression(#texttest,"(?i)^Title:.+?Body:",""),"Global")

 

Here's an example of the text I want to delete Title to Body:

 

Title:
Bald Heads

Word Count:
253

Summary:
Over the ages, baldness has been considered a disease. Lately, it has also been followed as a fashion. However, greater numbers of people still feel that a head covered by hair is always more attractive than a bald one.


Keywords:
Bald, Bald Heads, Bald Women, Bald Men


Article Body:

Edited by ATuringtest
Link to post
Share on other sites

So I created a text file and put this in it

 

start

Everything in between

status

 

 

Then used your regular expression replace

 

(?i)^start.+?status

 

set(#texttest,$read file("C:\\Users\\Golden\\Desktop\\test_replace.txt"),"Global")
set(#replaceTitle,$replace regular expression(#texttest,"(?i)^start.+?status"," "),"Global")

 

You would think if your expression is correct it would work ? But it doesn't, I cant explain it?

Link to post
Share on other sites

You probably want this then:

set(#article,$replace regular expression("Title:
Bald Heads

Word Count:
253

Summary:
Over the ages, baldness has been considered a disease. Lately, it has also been followed as a fashion. However, greater numbers of people still feel that a head covered by hair is always more attractive than a bald one.


Keywords:
Bald, Bald Heads, Bald Women, Bald Men


Article Body:
Here is the article...","(?si)^title.+?body:\\n",""),"Global")
  • Like 1
Link to post
Share on other sites

 

You probably want this then:

set(#article,$replace regular expression("Title:
Bald Heads

Word Count:
253

Summary:
Over the ages, baldness has been considered a disease. Lately, it has also been followed as a fashion. However, greater numbers of people still feel that a head covered by hair is always more attractive than a bald one.


Keywords:
Bald, Bald Heads, Bald Women, Bald Men


Article Body:
Here is the article...","(?si)^title.+?body:\\n",""),"Global")

 

 

Yep that worked a treat mate thanks again :)

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