maybe some people know jdownloader2. its a download manager. regex is also used with the download manager. so i want to tell you what i basically try to do: i have multiple txt files with many links. all text files have file names, of course. i would like to drag and drop all text files into jdownloader2, so it decrypts the txt files and adds each text file to a package. the package name shall be the txt files name. what i found so for is this:
[ {
"enabled" : true,
"maxDecryptDepth" : 2,
"name" : null,
"pattern" : "file:/.*?\\.txt$",
"rule" : "DEEPDECRYPT",
"packageNamePattern" : null,
"formPattern" : null,
"deepPattern" : null,
"rewriteReplaceWith" : null
} ]
this makes jdownloader to crawl the links from a txt file. but the problem is: it gives every single file in the links an own name, because packagenamepattern has noe definiton. so it uses the original file names in the links to make packages. so if i have a txt file with 100 links, it will make 100 packages with different names. but i want it to read the 100 links in the txt file and put them all in one package. so.. how do i need to change "packagenamepattern" to make jdownloader2 put all 100 links from a text file into one package, and the package name should be the textfiles name. it has something to do with regex, i think (i hope im not wrong with my thinking)
thanks in advance.
Asuming it works for finding the text files with the partern, you can add the pattern as string for the packagename, instead of null. I didn't understood quite for what stands each variable exactly: "name" : null, "pattern" : "file:/.*?\.txt$", "rule" : "DEEPDECRYPT",
String regex_package_name = "\\.*\.txt" /*is where you define your regexcode to locate filename starting with last "\(for windows, or "/" for Linux) until end of the filename (".txt").*/
I tested it myself an it works (on regex_tester)
The problem that you have is that for each matcher found, an index will be incremented and so will be added a new file for each link. You have to introduce a while loop that goes trough all the file first with a break condition when reaching the last char. Also there should not be nulls for the other values if you want to define a packagename ("packageNamePattern","formPattern","deepPattern")
If this doesn't work, you have to implement yourselve a method that reads all the links from 1 file and stores them in another file (.txt or .java) with the name of the file. This is how much I can help.
Have a nice day ;-)