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



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


  • SvenSven
    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".

    will look for "h1" and only use what's to the left of that from now on (><a href="/url">Hello</a></h1>)
    will look for "href" and only use what's to the left of that from now on (="/url">Hello</a></h1>)
    will look for ">". Since this is the last frontx what's matched will be considered the extract variable
    will look for "<". "Hello" will be the extracted text.
    "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
    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
    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>

  • SvenSven
    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
    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:

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