is this the correct general expression?

Discussion in 'Google Analytics' started by vince81, Oct 12, 2015.

  1. #2
    I'm using:

    .*/recharge#/buy/ok/(\w*|(\w+%?\d+?\w+?)|(\w+%?\d+?\w+%?\d+?\w+)|(\w+%?\d+%?\d+\w+%?\d+?)|(\w+.\w+)|(\w+%?\d+\w+%?\d+\w+%?\w+))/(\w*|(\w+%?\d+?\w+?)|(\w+%?\d+?\w+%?\d+?\w+)|(\w+%?\d+%?\d+\w+%?\d+?)|(\w+.\w+)|(\w+%?\d+\w+%?\d+\w+%?\w+))


    domain/recharge#/buy/ok/']domain/recharge#/buy/ok/2000/1444633877

    where:

    2000 = payment method, can also be any other 4 digit code
    1444633877 = unique payment id


    Other options:

    A: .*/recharge#/buy/ok/d{4}/d{10}
    B: .*/recharge#/buy/ok/*
    C: domain/recharge#/buy/ok/(.*)
    D: domain/recharge#/buy/ok/(.*)/(.*)
    Any ideas?

    Thanks!
     
    vince81, Oct 12, 2015 IP
  2. SMistert

    SMistert Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #3
    Hello,

    It really depends how specific you want it to be.
    1)Do you absolutely want 4 digits for the payment mode?
    2) Do you absolutely want 10 digits for the payment id?

    The RegEx your are proposing will match the following as well:

    domain/recharge#/buy/ok//"]www.google.com/recharge#/buy/ok/']domain/recharge#/buy/ok//

    (this is valid without the numbers...I guess this is not what you want)

    You can try the following RegEx (you must escape the forward slash with a backslash...It looks like a big V but it isn't):

    .*\/recharge#\/buy\/ok\/\d{4}\/\d{10}

    You can test you regex with any website like the following one:

    http://www.regextester.com/

    Regards,

    Sylvain
     
    SMistert, Oct 13, 2015 IP