ATuringtest 14 Posted April 8, 2020 Report Share Posted April 8, 2020 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 Quote Link to post Share on other sites
HelloInsomnia 1103 Posted April 8, 2020 Report Share Posted April 8, 2020 Replace regular expression using: (?i)^start.+?status 1 Quote Link to post Share on other sites
ATuringtest 14 Posted April 9, 2020 Author Report Share Posted April 9, 2020 (edited) 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 HeadsWord Count:253Summary: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 MenArticle Body: Edited April 9, 2020 by ATuringtest Quote Link to post Share on other sites
ATuringtest 14 Posted April 9, 2020 Author Report Share Posted April 9, 2020 So I created a text file and put this in it startEverything in betweenstatus 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? Quote Link to post Share on other sites
ATuringtest 14 Posted April 9, 2020 Author Report Share Posted April 9, 2020 Edit, it worked fine Nick , problem was the amount of new lines, cleaned them up in to a single line and bam !! worked lol Thanks Quote Link to post Share on other sites
HelloInsomnia 1103 Posted April 9, 2020 Report Share Posted April 9, 2020 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") 1 Quote Link to post Share on other sites
ATuringtest 14 Posted April 16, 2020 Author Report Share Posted April 16, 2020 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 Quote Link to post Share on other sites
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.