Hey guys!
I wanted to use regex to remove the unwanted data from my text file. It goes like this:
I have 2 doubts here:
1. I know my data always lies between the tags <pre> and </pre>. I have extracted this already.
But between the tags, sometimes ## comes too. I want to replace all the # and the text between them with a space. What's the best way to go about it?
2. Also, is it possible to extract the data from the data in the form 201808010000 (date and time)
Would really appreciate the help!
Solved! Go to Solution.
Assuming these hashtags appear on a single line, you could split to rows on \n and then simply use the expression,
#.*#
And replace it with nothing (or an empty string to be more precise) in the Regex Tool.
If you care to share some data, I'm sure this is possible.
Hi @yashs
Lets me answer your 2nd question yes you can extract datetime from the string
Formula
DateTimeParse(ToString([DATE]),"%Y%m%d%H%M")
Hope this helps 🙂
I tried this approach earlier. But as it removes any data between #, it also removes 'needed data 1'
If you notice in the pic I shared, 'Needed data 1' also falls between # in a way
I have attached a file of my actual data. I need all the data which lies after this pattern
'201701010538 TAF KROC'
Except for the data which lies between # ofcourse
@atcodedog05
I have not yet gone through your solution for the date issue. But the data for date is slightly different. In the format of data for the attached file, I can extract it by pulling out the first numbers.
In this format, you can see the data still lies between <pre> tags, but the date appears above in <td> tag, which is repetitive. The output from this type of data should be the same as output mentioned in the file. Each line ( From TAF AMD KMKE........0VC008=) should have respective date before it
To avoid confusion here, I have 2 types of inputs, one shown here in snip, and other attached in my previous reply named as testdata.txt. And output of 1 format, as attached here
Hi @yashs
I am able to get output as your expected output using some filter.
Please check and let me know.
It's working!
Thank you so much for your help!! Really appreciate it!