Insert variable in regex?

Discussion in 'A-Parser Support Forum' started by scrapefun, Jun 29, 2018.

  1. scrapefun

    scrapefun A-Parser Enterprise License
    A-Parser Enterprise

    Joined:
    Feb 24, 2015
    Messages:
    184
    Likes Received:
    34
    In the screenshot below I want to insert the query value into the regex I am using to check the content of a page.

    Is this possible?

    [​IMG]

    eyJwcmVzZXQiOiJORVcgU1RYIiwidmFsdWUiOnsicHJlc2V0IjoiTkVXIFNUWCIs
    InBhcnNlcnMiOltbIk5ldDo6SFRUUCIsImRlZmF1bHQiLHsidHlwZSI6Im92ZXJy
    aWRlIiwiaWQiOiJnb29kQ29kZSIsInZhbHVlIjpbMjAwXX0seyJ0eXBlIjoib3Zl
    cnJpZGUiLCJpZCI6InVzZXItYWdlbnQiLCJ2YWx1ZSI6Ik1vemlsbGEvNS4wIChX
    aW5kb3dzIE5UIDEwLjA7IFdpbjY0OyB4NjQpIEFwcGxlV2ViS2l0LzUzNy4zNiAo
    S0hUTUwsIGxpa2UgR2Vja28pIENocm9tZS82Ny4wLjMzOTYuOTkgU2FmYXJpLzUz
    Ny4zNiJ9LHsidHlwZSI6Im92ZXJyaWRlIiwiaWQiOiJwcm94eXJldHJpZXMiLCJ2
    YWx1ZSI6IjMifSx7InR5cGUiOiJvdmVycmlkZSIsImlkIjoicHJveHliYW5uZWRj
    bGVhbnVwIiwidmFsdWUiOiIwIn0seyJ0eXBlIjoib3ZlcnJpZGUiLCJpZCI6InRp
    bWVvdXQiLCJ2YWx1ZSI6IjYwIn0seyJ0eXBlIjoib3ZlcnJpZGUiLCJpZCI6InVz
    ZXByb3h5IiwidmFsdWUiOnRydWV9LHsidHlwZSI6Im92ZXJyaWRlIiwiaWQiOiJy
    ZXF1ZXN0ZGVsYXkiLCJ2YWx1ZSI6IjAifSx7InR5cGUiOiJvdmVycmlkZSIsImlk
    IjoicHJveHlDaGVja2VyIiwidmFsdWUiOiJubyBjaGVjayJ9LHsidHlwZSI6Im9w
    dGlvbnMiLCJpZCI6ImNoZW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mllcyI6IjIw
    MTA4NTA4LGJlc3QgY2FuYWwgYm9hdCBob2xpZGF5cyBpbiBmcmFuY2UsZGVza3Rv
    cCxnb29nbGUuY29tLHVzLGVuLGVuXG4yMDEwODUwOSx3aGF0IGlzIHRoZSBiZXN0
    IGFyZWEgZm9yIGNhbmFsIGJvYXRzIGluIGZyYW5jZSxkZXNrdG9wLGdvb2dsZS5j
    b20sdXMsZW4sZW4iLCJjYXRlZ29yeSI6W119fQ==
     
  2. Support

    Support Administrator
    Staff Member A-Parser Enterprise

    Joined:
    Mar 16, 2012
    Messages:
    4,559
    Likes Received:
    2,169
    Yes, it's possible.
    To do this, you need to explicitly access variables using the template engine:
    Code:
    html itemscope="" itemtype="http://schema.org/SearchResultsPage" lang="[% query.lang %]"
     
    scrapefun likes this.
  3. scrapefun

    scrapefun A-Parser Enterprise License
    A-Parser Enterprise

    Joined:
    Feb 24, 2015
    Messages:
    184
    Likes Received:
    34
    Thanks! worked perfectly.
     
    Support likes this.

Share This Page