Jump to content
Ketarin forum

Request: Multiple search, Regex a variable, split count


Recommended Posts

Hi floele,


what I´m trying to do is:


Prefered method:

- Loading an url

- finding multiple strings with regex

- saving the results in an array

- using the array to generate a pool down menu

- splitting a variable and getting the last part without knowing the split counts, or maybe getting the max count as command


So I solved it for now:

- Load an url

- find the first match and save it in VAR "FirstMatch"

- load the url one more time, find the end of first match and use it for Regex cursor to find second match

- and so on

- manual scripting the regex, cuz every app needs another method to get the last part

Very complicated!


In many cases It would be a great function to do not regex an url, but a variable and see what the hell I´m doing. ;-)

Maybe I did not find the right way, but if it´s really missing, such function would be GREAT and would speed up the updates, cuz I could save a content in a variable without loading the url every time I need to run another regex.


Any idea?


Help me and I´ll give you the best SF-Template you´ve ever seen ;-)

Link to comment
Share on other sites

Ok. My fault to put too many request in one post.


We´ve got a Variable "Test" with content Appname-irgendwas-nochwas-dir-version-Freeware-win32.exe

I want the part Appname (ok easy), maybe the third one, and last one. As long as I know the max count, I could use {test:split:-:6} to get "win32.exe" for my needs.


What I´m missing is a function like {test:split:-:last} which would let me grab this without knowing the part number and max count of splits.


Another example (and thats what I want to use it for) is spliting a webpage with tables, classes and rows. I know the last class, or table or what ever can be defined with a <TAG> is what I need, but the max count of splits is unkown and alterates for different application (like Softpedia), or shown advertisements (many webpages).


Next I put the different Classes in one Array {myArray:Regex1, Regex2,Regex3,........}


Next I would regex the saved content of my array and not loading the url any more to extract desired information. But there´s no way to see what the result of my doing is, cuz in Ketarin we´re only able to regex an url and see the blue and red lines.


Hopefully it´s now more clear? Alternatively I could explain it in german....would be much easier ;-)

Edited by Gozi
Link to comment
Share on other sites

The other option is to use something like this:



You can also regex pretty much any other variable to extract contents from it using that function...however, I would **really** love to have the ability to perform an XSL transform or use XSL selectors to obtain more specific info from HTML (like "slices" and such).

Link to comment
Share on other sites

Begin/End only works on certain HTML, too, though - so that's not really a good justification to exclude XSL. Even Regex is only useful if you can find a *unique* pattern that works for the specific data you're trying to capture. XSL is really a useful tool when it *can* work, and if it becomes an option within Ketarin, it could be very useful to those geeks like me that will find ways to make it work. :)


Also, if it's implemented as a function, instead of only a capture type, we would be able to utilize it with well-formed data once we've mostly sanitized it using other methods.


That said, I would really like the simplicity of using the IE "slice" method of simply tagging the returned region with an anchor reference in the URL.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.