Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    stiller_leser
    @stiller_leser_twitter
    Is it possible to filter by timestamp? Say I have a timestamp in my json and I would only like to retrieve the entries from the last 5 minutes?
    glenveegee
    @glenveegee
    @Mo_Jim_twitter I don't think that's possible. What language are you coding in?
    @stiller_leser_twitter If it's a formatted date then no. If it's in milliseconds then yes but only if you hard code now time
    What language are you working with?
    glenveegee
    @glenveegee
    @jamesls please, please, please can we look at a proposal for an entries function in the spec so we can get object keys and values in the same execution context.
    This isn't the first time this sort of query has arisen and I'm certain it won't be the last
    stiller_leser
    @stiller_leser_twitter
    Hm ok @glenveegee is there a way to only get the last x entries then? Currently my query looks like this: resources[?involvedObject.apiVersion == v1 && involvedObject.kind == Service && involvedObject.name==my-name].{ firstTimestamp: firstTimestamp, lastTimestamp: lastTimestamp, count: count, reason: reason, message: message }
    glenveegee
    @glenveegee
    Yes you can use slices
    I your case search([-x:], [0, 1, 2, 3]) -> [2, 3] where x is a number - the last x entries
    stiller_leser
    @stiller_leser_twitter
    How would I wrap this around my existing search?
    glenveegee
    @glenveegee

    for the last 5 you'd do something like

    resources[?involvedObject.apiVersion == v1 && involvedObject.kind == Service && involvedObject.name==my-name].{ firstTimestamp: firstTimestamp, lastTimestamp: lastTimestamp, count: count, reason: reason, message: message }[-5:]

    ...at least that's what I think you'd have to do

    stiller_leser
    @stiller_leser_twitter
    That's correct. I kept trying to get it too work with search :D Thank you for the help here!
    meschiany
    @meschiany
    Hello, I have a structure query i could not figure out, is this the place?

    {
    "tags": {
    "private_password_reset": {
    "tag_name": "PasswordResetSettings"
    },
    "users": {
    "tag_name": "users"
    }
    }
    }

    result should be: PasswordResetSettings, users

    glenveegee
    @glenveegee
    tags.*.tag_name
    join(', ', tags.*.tag_name)
    meschiany
    @meschiany
    wow, you made it look very easy, thank you
    varajgandhi
    @varajgandhi
    ^[8-9]\d{7}$ this regx not working for json params..mobile number only starting with 8 or 9 and totally 8 digits
    kindly advise anyone
    also single \ throws error in JSON
    glenveegee
    @glenveegee
    Regex search and filter is not part of the jmespath spec as far as I'm aware. Where's this coming from?
    varajgandhi
    @varajgandhi
    am passing value for angular form
    glenveegee
    @glenveegee
    'angular' so I'm assuming JS/TS then what jmespath library are you using?
    What is your input to the jmespath search function and what does your expression look like
    varajgandhi
    @varajgandhi
    image.png
    currently, params take 0-9 as the first digit for a phone number but I need to change the pattern for the starting digit , it must accept either 8 or 9
    glenveegee
    @glenveegee
    Ah. Don't think this has anything to do with JMESPath but fwiw your regex could be written as ^[89][0-9\-]*$. The regex in the image isn't particularly good because it permits a telephone number like 8------------------------5
    You might want to rewrite that regex anyway to make it stricter
    From your initial question I see the regex you started with though ^[8-9]\d{7}$
    varajgandhi
    @varajgandhi
    yes, it doesn't work
    ^[89][0-9]\d{7}*$ also not working
    glenveegee
    @glenveegee
    This is probably because you aren't setting multiline flags
    you should just be able to do [89]\d{7}
    if you can't set flags
    varajgandhi
    @varajgandhi
    [89]\d{7} single \ can't accept in json and also 2-8 digits must in 0-9
    glenveegee
    @glenveegee
    escape it with another slash
    [89]\\d{7}
    If you want yo use the form ^[89]\\d{7}$ then somewhere in your code you should be doing new Regex(params, 'm')
    varajgandhi
    @varajgandhi
    okay, it's only for the first digit, what about 2 to 8 digits?
    glenveegee
    @glenveegee
    What is the format of the phone number
    What are the possible formats should I say
    varajgandhi
    @varajgandhi
    the first number must start with 8 or 9 and 2 to 8 digits accept 0 to 9
    glenveegee
    @glenveegee
    [89]\\d{2,8}
    varajgandhi
    @varajgandhi
    i will try
    not working ..
    glenveegee
    @glenveegee
    Any error or hint why?
    varajgandhi
    @varajgandhi
    throws error
    glenveegee
    @glenveegee
    which is?
    varajgandhi
    @varajgandhi
    image.png