how to do a conditional if then ?

Hi all, this has probably been answered before. But here goes.
I am scraping a simple baseball page. Some times a pitchers name has a link around it, and sometimes it does not.
example:

D. Oliver (L)

D. Cone (R)

What I wnat to do is determine if there is a link, if so I would write something like this:

~@PLAYER_NAME@~~@IGNORE@~

if there is no link, I would write the following

~@PLAYER_NAME@~

Thanks in advance

how to do a conditional if then ?

Hi Steve,

There is presently no order to sub-extractor patterns. We've just had a small internal discussion about it, though, and the consensus is that this would be useful on occasion. As such, we'll be including it in one of the upcoming alpha versions of screen-scraper (perhaps even the next one). If you'd like, try upgrading occasionally to the latest alpha, and you'll see it show up. You'll be able to tell by the "Sequence" boxes that will show up next to each of the sub-extractor patterns.

In the meantime, your best bet will simply be to use regular expressions and slightly larger sub-extractor patterns to ensure that they're matching only when and how much you want them to.

Kind regards,

Todd

how to do a conditional if then ?

Todd,
I've run into the same issue as the example in the first post of this thread. I've tried sub-extractors as he's indicated. It worked at first. However upon saving (or closing and restarting screen scraper), the sub-extractors sequence order is not reliable - they get reordered. Note that if his second sub extractor is called first (due to reordering) it will match first and you get the ... tags in your data - just what you wanted to avoid.

Any reason why sub-extractor order is not preserved on saving and reloading? It seems crucial to having this example work properly, i.e. you want to match the most specific first.

Thanks,
Steve

how to do a conditional if then ?

Hi,

Roy's got you on the right track. The simplest way would be to use sub-extractor patterns. You would then have two sub extractor patterns which would match the two different cases (with or without the link). Note that you could also do the same with two separate extractor patterns, but it's generally more efficient to use sub-extractor patterns in cases like these.

Just let me know if I can provide more detail on that.

Thanks,

Todd

how to do a conditional if then ?

I'd take a look at sub patterns -- get the main match from datacell and then do a submatch for components. Just guessing here, as I've never used the submatch/sub patterns feature.