Skip to content

front, front1, front2...

This question is regarding front and back as used in extract variables.

The documentation states that you can separate multiple variations using "|", so what's the point of having front1, front2 and so on? Wouldn't just "front" be enough? What's the difference between:
front = a|b

and 

front=a
front1=b
?

Also, what if front5 doesn't exist? Will front6 and the ones following still be taken into accout?

Comments

  • SvenSven www.GSA-Online.de
    front=a|b will stop if it finds a and not search for b or if not found a will search for b as alternative

    front1=a << must find a and will only continue once it did
    front2=b << must first find b else it will not return anything
  • Let me see if I get this right.

    Say the html looks like this:
    <h1><a href="/url">Hello</a></h1>
    and I want to extract "Hello".

    front=h1
    will look for "h1" and only use what's to the left of that from now on (><a href="/url">Hello</a></h1>)
    front1=href
    will look for "href" and only use what's to the left of that from now on (="/url">Hello</a></h1>)
    front2=>
    will look for ">". Since this is the last frontx what's matched will be considered the extract variable
    back=<
    will look for "<". "Hello" will be the extracted text.
    back1=h1
    "h1" is found in "/a></h1>" so hello is returned.

    Is this correct?


  • Or will this return "Hello</a><" because the last backx is "h1"?
  • SvenSven www.GSA-Online.de
    front2=> will get you either <a href="/url">Hello</a></h1> or Hello</a></h1>
    back=h1 will remove that from the end and turn it to either <a href="/url">Hello</a></ or Hello</a></
  • What if you have all 5 commands in that order? Will the answer be "Hello" or "Hello</a><"?
  • SvenSven www.GSA-Online.de
    well front and front1 is the same. front is read and then front2...front1 is left out. Same for back and back1...just back is read here or if back is not there then back1
  • Ok I think I understand how front works but I'm still not sure about back.

    Can you please explain what would the following code extract?

    <h1><a href="/url">Hello</a></h1>

    front=href="
    back1=</a>
    back2=</h1>
  • SvenSven www.GSA-Online.de
    The "back" is handled some way differently. All back variables are handled and they do not all have to be present to accept an extraction.
  • How does it work then? Does it try to match the back variables one by one and stops as soon as of of them matches?
  • SvenSven www.GSA-Online.de
    well, it will take all of the variations and cut from the end if found.
  • ihulubihulub Romania
    edited February 2016
    So if I have this:
    <h1><a href="/url">Hello</a></h1>

    and this code:
    front=href
    front2=>
    back=h1
    back2=</a

    will it extract "Hello"?
  • SvenSven www.GSA-Online.de
    yes, however you can make your life easier with:
    front=<a href="/url">
    back=<
Sign In or Register to comment.