shawn Posted September 11, 2010 Report Share Posted September 11, 2010 I've used a layered approach to building variables on a LOT of searches, and have always been able to get them to work. This time, not so much. This specific search is designed using my SF template (still a work in progress, obviously). The SF template offers several variables which you use to feed strings into the filepattern capture. The problem is, while it works in every other situation I've tried, since I imported this search, it doesn't work. Instead, the {sdownload} variable actually includes: http://downloads.sourceforge.net/mpc-hc//projects?/mpc-hc/files/([^'"]*[^'"]*[^'"/\?&]*[^'"/]+1.4.2499.0[^'"/]+x86[^'"/\?&]*\.exe[^'"/\?&]*)['"/\?&]?download It SHOULD have been replaced with the {filepattern} capture. Hm. Now that I think about it, maybe it's not capturing at all, so it's returning the entire string from the variable? On that note, if that's the case, it would be SO nice if we could set a variable to always return empty if there is no capture result. Maybe a checkbox to this effect for each variable. Here's the XML: <?xml version='1.0' encoding='utf-8'?> <Jobs> <ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="b946d582-c161-4033-95b8-d86c91522759"> <WebsiteUrl>{swebsite}</WebsiteUrl> <UserNotes /> <LastFileSize>0</LastFileSize> <LastFileDate xsi:nil="true" /> <IgnoreFileInformation>false</IgnoreFileInformation> <DownloadBeta>Default</DownloadBeta> <DownloadDate xsi:nil="true" /> <CheckForUpdatesOnly>false</CheckForUpdatesOnly> <VariableChangeIndicator>{version}</VariableChangeIndicator> <CanBeShared>true</CanBeShared> <ShareApplication>false</ShareApplication> <ExclusiveDownload>false</ExclusiveDownload> <HttpReferer>http://sourceforge.net/</HttpReferer> <Variables> <item> <key> <string>sftag</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>mpc-hc</TextualContent> <Name>sftag</Name> </UrlVariable> </value> </item> <item> <key> <string>version</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>RegularExpression</VariableType> <Regex>/projects?/[^'"]+[/\s]v?([\d\.]+)[_\./\s]</Regex> <Url>http://sourceforge.net/projects/{sftag}/files/</Url> <Name>version</Name> </UrlVariable> </value> </item> <item> <key> <string>filepath</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent /> <Name>filepath</Name> </UrlVariable> </value> </item> <item> <key> <string>filestart</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent /> <Name>filestart</Name> </UrlVariable> </value> </item> <item> <key> <string>filemiddle</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>{version}</TextualContent> <Name>filemiddle</Name> </UrlVariable> </value> </item> <item> <key> <string>fileend</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>x86</TextualContent> <Name>fileend</Name> </UrlVariable> </value> </item> <item> <key> <string>fileext</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>exe</TextualContent> <Name>fileext</Name> </UrlVariable> </value> </item> <item> <key> <string>filepattern</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>/projects?/{sftag}/files/([^'"]*{filepath}[^'"]*[^'"/\?&]*{filestart}[^'"/]+{filemiddle}[^'"/]+{fileend}[^'"/\?&]*\.{fileext}[^'"/\?&]*)['"/\?&]</TextualContent> <Name>filepattern</Name> </UrlVariable> </value> </item> <item> <key> <string>sdownload</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>http://downloads.sourceforge.net/{sftag}/{filepattern}?download</TextualContent> <Name>sdownload</Name> </UrlVariable> </value> </item> <item> <key> <string>groupid</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>RegularExpression</VariableType> <Regex>\?group_id=([\d]+)</Regex> <Url>http://sourceforge.net/projects/{sftag}/</Url> <Name>groupid</Name> </UrlVariable> </value> </item> <item> <key> <string>swebsite</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>http://sourceforge.net/projects/{sftag}/</TextualContent> <Name>swebsite</Name> </UrlVariable> </value> </item> <item> <key> <string>schangelog</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>http://sourceforge.net/news/?group_id={groupid}</TextualContent> <Name>schangelog</Name> </UrlVariable> </value> </item> <item> <key> <string>snotes</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent /> <Name>snotes</Name> </UrlVariable> </value> </item> </Variables> <ExecuteCommand /> <ExecutePreCommand /> <Category>Media</Category> <SourceType>FixedUrl</SourceType> <PreviousLocation /> <DeletePreviousFile>true</DeletePreviousFile> <Enabled>true</Enabled> <FileHippoId /> <LastUpdated xsi:nil="true" /> <TargetPath>.\{category}\{appname:regexreplace:([\s\t\r\n\-\\&]+):_}-{version}.{url:ext}</TargetPath> <FixedDownloadUrl>{sdownload}</FixedDownloadUrl> <Name>MPC HC x86</Name> </ApplicationJob> </Jobs> Link to comment Share on other sites More sharing options...
shawn Posted September 11, 2010 Author Report Share Posted September 11, 2010 My mistake. I assigned the variable type incorrectly (Textual vs RegularExpression). Sigh. See what I get for working 'til 5 am? Revised (and working!): <?xml version='1.0' encoding='utf-8'?> <Jobs> <ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="b946d582-c161-4033-95b8-d86c91522759"> <WebsiteUrl>{swebsite}</WebsiteUrl> <UserNotes /> <LastFileSize>5165571</LastFileSize> <LastFileDate>2010-09-07T07:41:19-07:00</LastFileDate> <IgnoreFileInformation>false</IgnoreFileInformation> <DownloadBeta>Default</DownloadBeta> <DownloadDate xsi:nil="true" /> <CheckForUpdatesOnly>false</CheckForUpdatesOnly> <VariableChangeIndicator>{version}</VariableChangeIndicator> <CanBeShared>true</CanBeShared> <ShareApplication>false</ShareApplication> <ExclusiveDownload>false</ExclusiveDownload> <HttpReferer>http://sourceforge.net/</HttpReferer> <Variables> <item> <key> <string>sftag</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>mpc-hc</TextualContent> <Name>sftag</Name> </UrlVariable> </value> </item> <item> <key> <string>version</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>RegularExpression</VariableType> <Regex>/projects?/[^'"]+[/\s]v?([\d\.]+)[_\./\s]</Regex> <Url>http://sourceforge.net/projects/{sftag}/files/</Url> <Name>version</Name> </UrlVariable> </value> </item> <item> <key> <string>filepath</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent /> <Name>filepath</Name> </UrlVariable> </value> </item> <item> <key> <string>filestart</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent /> <Name>filestart</Name> </UrlVariable> </value> </item> <item> <key> <string>filemiddle</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>{version}</TextualContent> <Name>filemiddle</Name> </UrlVariable> </value> </item> <item> <key> <string>fileend</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>x86</TextualContent> <Name>fileend</Name> </UrlVariable> </value> </item> <item> <key> <string>fileext</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>exe</TextualContent> <Name>fileext</Name> </UrlVariable> </value> </item> <item> <key> <string>filepattern</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>RegularExpression</VariableType> <Regex>/projects?/{sftag}/([^'"]*{filepath}[^'"]*[^'"/\?&]*({version}/)?{filestart}[^'"/]+{filemiddle}[^'"/]+{fileend}[^'"/\?&]*\.{fileext}[^'"/\?&]*)['"/\?&]</Regex> <Url>http://sourceforge.net/projects/{sftag}/files/{filepath}</Url> <TextualContent /> <Name>filepattern</Name> </UrlVariable> </value> </item> <item> <key> <string>sdownload</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>http://downloads.sourceforge.net/{sftag}/{filepattern}?download</TextualContent> <Name>sdownload</Name> </UrlVariable> </value> </item> <item> <key> <string>groupid</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>RegularExpression</VariableType> <Regex>\?group_id=([\d]+)</Regex> <Url>http://sourceforge.net/projects/{sftag}/</Url> <Name>groupid</Name> </UrlVariable> </value> </item> <item> <key> <string>swebsite</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>http://sourceforge.net/projects/{sftag}/</TextualContent> <Name>swebsite</Name> </UrlVariable> </value> </item> <item> <key> <string>schangelog</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent>http://sourceforge.net/news/?group_id={groupid}</TextualContent> <Name>schangelog</Name> </UrlVariable> </value> </item> <item> <key> <string>snotes</string> </key> <value> <UrlVariable> <RegexRightToLeft>false</RegexRightToLeft> <VariableType>Textual</VariableType> <Regex /> <TextualContent /> <Name>snotes</Name> </UrlVariable> </value> </item> </Variables> <ExecuteCommand /> <ExecutePreCommand /> <Category>Media</Category> <SourceType>FixedUrl</SourceType> <PreviousLocation /> <DeletePreviousFile>true</DeletePreviousFile> <Enabled>true</Enabled> <FileHippoId /> <LastUpdated>2010-09-11T04:32:26.9291331-07:00</LastUpdated> <TargetPath>.\{category}\{appname:regexreplace:([\s\t\r\n\-\\&]+):_}-{version}.{url:ext}</TargetPath> <FixedDownloadUrl>{sdownload}</FixedDownloadUrl> <Name>MPC HC x86</Name> </ApplicationJob> </Jobs> Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now