Remove more than 1000 words

Hi,

i try to remove some texts in the text file that contains more than 1400 words so i try to use regex command but its limited to 255 words any one helps to remove that words i used below command
txtPDF.Replace("<that total1400+ characters>","")

Hi,

You can use List of strings to hold the 1400 words, then using loop you can replace using regex.

Regex.Replace(lst(i), "test", "", RegexOptions.IgnoreCase)

its not working can you share full syntax

Hi @Shriharsha_H_N

Are you trying to trim your 1400 words to 1000? Reduce it or do some string operations? Give some more details please…

@Raghavendraprasad Hi i just wanted to replace that 1400 words to empty or single space

So now if I understand correctly you are clearing the contents of the text file after getting the word count? If more than 1400 words are present you will clear all words (replace with empty string) and save the file?

No not like that <1400 character word>
So in that 1400 characters is a constant so i need to remove of middle data and add 1st and last variable into single line

Okay can you upload an input text file and an expected output file so that I can build a workflow?

@Raghavendraprasad 0.152||* Standard quantities 123456780901234567890125469744khjdgfjdsvf sjgfsdjkfbsdjgfjkfhbj gjhgjksdavfdsajdfhdakj khvjsafhsakjdfh nvfjhgjgjhgkh ghjgjgjhgjhg gjhfgjhgjhsd fnk hkhkjsdgfksgdfkjsh jhjkgfksdgfjksdgfksdh kjhgkgkgkj ghkhkjhkjh hkjgfjdgfjgsdfhg fhjkagfjgfjdsagfksdahfksdhfshfksdfhkj khfdjkfkdsjhfsdhfkjhh jhfsdgfjshfsdfkhkj 69744khjdgfjdsvf sjgfsdjkfbsdjgfjkfhbj gjhgjksdavfdsajdfhdakj khvjsafhsakjdfh nvfjhgjgjhgkh ghjgjgjhgjhg gjhfgjhgjhsd fnk hkhkjsdgfksgdfkjsh jhjkgfksdgfjksdgfksdh kjhgkgkgkj ghkhkjhkjh hkjgfjdgfjgsdfhg fhjkagfjgfjdsagfksdahfksdhfshfksdfhkj khfdjkfkdsjhfsdhfkjhh jhfsdgfjshfsdfkhkj69744khjdgfjdsvf sjgfsdjkfbsdjgfjkfhbj gjhgjksdavfdsajdfhdakj khvjsafhsakjdfh nvfjhgjgjhgkh ghjgjgjhgjhg gjhfgjhgjhsd fnk hkhkjsdgfksgdfkjsh jhjkgfksdgfjksdgfksdh kjhgkgkgkj ghkhkjhkjh hkjgfjdgfjgsdfhg fhjkagfjgfjdsagfksdahfksdhfshfksdfhkj khfdjkfkdsjhfsdhfkjhh jhfsdgfjshfsdfkhkj69744khjdgfjdsvf sjgfsdjkfbsdjgfjkfhbj gjhgjksdavfdsajdfhdakj khvjsafhsakjdfh nvfjhgjgjhgkh ghjgjgjhgjhg gjhfgjhgjhsd fnk hkhkjsdgfksgdfkjsh jhjkgfksdgfjksdgfksdh kjhgkgkgkj ghkhkjhkjh hkjgfjdgfjgsdfhg fhjkagfjgfjdsagfksdahfksdhfshfksdfhkj khfdjkfkdsjhfsdhfkjhh jhfsdgfjshfsdfkhkj69744khjdgfjdsvf sjgfsdjkfbsdjgfjkfhbj gjhgjksdavfdsajdfhdakj khvjsafhsakjdfh nvfjhgjgjhgkh ghjgjgjhgjhg gjhfgjhgjhsd fnk hkhkjsdgfksgdfkjsh jhjkgfksdgfjksdgfksdh kjhgkgkgkj ghkhkjhkjh hkjgfjdgfjgsdfhg fhjkagfjgfjdsagfksdahfksdhfshfksdfhkj khfdjkfkdsjhfsdhfkjhh jhfsdgfjshfsdfkhkj69744khjdgfjdsvf sjgfsdjkfbsdjgfjkfhbj gjhgjksdavfdsajdfhdakj khvjsafhsakjdfh nvfjhgjgjhgkh ghjgjgjhgjhg gjhfgjhgjhsd fnk hkhkjsdgfksgdfkjsh jhjkgfksdgfjksdgfksdh kjhgkgkgkj ghkhkjhkjh hkjgfjdgfjgsdfhg fhjkagfjgfjdsagfksdahfksdhfshfksdfhkj khfdjkfkdsjhfsdhfkjhh jhfsdgfjshfsdfkhkj69744khjdgfjdsvf sjgfsdjkfbsdjgfjkfhbj gjhgjksdavfdsajdfhdakj khvjsafhsakjdfh nvfjhgjgjhgkh ghjgjgjhgjhg gjhfgjhgjhsd fnk hkhkjsdgfksgdfkjsh jhjkgfksdgfjksdgfksdh kjhgkgkgkj ghkhkjhkjh hkjgfjdgfjgsdfhg fhjkagfjgfjdsagfksdahfksdhfshfksdfhkj khfdjkfkdsjhfsdhfkjhh jhfsdgfjshfsdfkhkj batch |0014

this is the input file 0.152| and 0014 … is the ouput file what ever in the middle data of this variables i need to remove mean what ever * Standard to batch is thr i need to remove it

Hey,

You can do this using substring functionality to get 0.152 and 0014, if these two values are with the same fixed length.

i cant possible use substring this data available in more than 20 pages middle

I am able to replace those words as you send above
Sequence.xaml (8.3 KB)

Hey @Shriharsha_H_N

Seems like a new facet of the problem is introduced every-time a question is asked.

Can you please tell the ‘full’ requirement. The sample you provided is fairly easy too do using string operations, RegEx etc., but now you are saying there might be multiple pages how many pages can you approx. tell me?

As string storage will go at the top end of 2GB also but it might depend on the VM/memory setting too so a limitation might creep up during run-time when larger files are introduced.

Maybe we will have to try streamreader and then deal with the text file line by line and then replace them to the memory pointer.

Anyway I have built a rudimentary workflow that will achieve your objective and this should be good for less than 3 lakh lines in a text file but anything more then you will have to use memory pointers.

Find the xaml here (click to download)

Regards :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.