Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    glenveegee
    @glenveegee
    If that's the case then you don't need the 2 to 8 condition
    Also if you definitely don't want to have a number longer than 8 digits you're going to have to use the multiline flag
    lastly in case the slash \ characters are causing trouble you could set it as follows:
    ^[89][0-9]{7}$
    if that doesn't work then there's something else going on.
    Make sure you're trimming values before trying to match them
    but other than that the regex above will only match a maximum of 8 digits where the starting digit is either an 8 or a 9
    varajgandhi
    @varajgandhi
    okay , i will try
    its not working,,anyway thank you for your timely support..
    glenveegee
    @glenveegee
    :thumbsup:
    You could always try confirming if there's something else going on by setting a very loose regex
    .*
    If that fails then there's definitely something screwed
    and if that passed you could slowly build up the regex to determine what exactly is causing the problem
    varajgandhi
    @varajgandhi
    Default validation takes for a phone number field, based on country code starting number validation, currently 3,6,8,9 accepts in the first digit, but the client wants only 8 or 9 as a starting digit. so only am tried to override the validation..
    glenveegee
    @glenveegee
    Perhaps try something like a regex playground to work out what you need based on what you have
    varajgandhi
    @varajgandhi
    yeah already am using this one..anyway thank you so much glen
    Jason Bullen
    @Bullenj01

    Struggling with this data all day. I'm fairly new to jmes and thinking I'm missing something fundamental here that I hope you may assist with

    { "imdata": [ { "l1PhyIf": { "attributes": { "dn": "pod-1/130/eth1-30" "adminSt": "enabled" }, "children": [ { "ethpmPhysIf": { "attributes": { "allowedVlans": "10" } } } ] } } ] }

    Trying to group values from children as another k,v pair with data from attributes without it being in another sublist. end result would look like

    "switch_name": "pod-1/130/eth1-30" "status": "enabled" "vlans": "10"

    Jason Bullen
    @Bullenj01

    this is what I have but I don't want vlans in another list

    imdata[].l1PhyIf.{status:attributes.adminSt,vlans:children[].*.attributes.allowedVlans}

    Code Warrior
    @pr0gramar
    Hi all - is there a way to add another key the output that is conditional based on value of an existing key?
    glenveegee
    @glenveegee
    @Bullenj01 as soon as you're talking about grouping values then the standard spec is not powerful enough to provide what you need. depending on the language you're working in there are other libraries out there that augment the spec and do actually provide the necessary functions to get done what it is you require
    @pr0gramar I think I understand what you mean but an example would be nice
    Guillaume Gillon
    @GGui
    Hi everyone, i use jmespath.py . is there any way get path of each response?
    Guillaume Gillon
    @GGui
    I would like to get the path in the json of each result
    Markus Geiger
    @markus-geiger

    Hi, how do i select by different key?

    aws ec2 describe-instances --instance-id "$INSTANCE_ID" \
    --query 'Reservations[0].Instances[0].BlockDeviceMappings[?(DeviceName==`/dev/sda1`)]'
    
    [
        {
            "DeviceName": "/dev/sda1",
            "Ebs": {
                "AttachTime": "2020-11-09T10:53:07+00:00",
                "DeleteOnTermination": true,
                "Status": "attached",
                "VolumeId": "vol-023ddef3ee401aa47"
            }
        }
    ]

    But i want it to be DeviceName==Reservations[0].Instances[0].RootDeviceName] ... wrong syntax?

    innocuoussoul
    @innocuoussoul

    How to a manipulate a common key to add a number to it?
    For example:
    Provider1: provider
    Provider2: provider

    Etc

    [].{provider: provider} gives me the date I want, but I want to change the key to include a number
    Essentially I need the keys to be unique values
    Paul Catinean
    @paulcatinean_gitlab
    Hi guys!
    I just discovered this library and it's such an amazing thing, wish it were more visible :D
    I am trying to filter a list of dictionaries rather than a json, I was thinking that making it to json string and then passing it to jmespath might be a bit wasteful, does jmespath also take python objects as input?
    omrishilton
    @omrishilton
    hello! is anyone available for a quick question?
    jdevillard
    @jdevillard
    Yep ?
    omrishilton
    @omrishilton

    I have this JSON

    {
    "containers": 
        [
            {
                "Labels": {
                    "com.docker.compose.service": "test1",
                    "version": "4.10.7"
                }
            },
            {
                 "Labels": {
                    "com.docker.compose.service": "test2"
                }
            }
        ]
    }

    and i'm using this filter containers[].Labels."com.docker.compose.service" which works fine. but i want to get only the items that contain Lables.version

    i've tried containers[].Labels[?version]."com.docker.compose.service"
    with no luck
    any idea how to make that work?
    i want my output to only be "test1"
    omrishilton
    @omrishilton
    @jdevillard got any ideas?
    jdevillard
    @jdevillard
    hum
    label is a n object
    not array
    you can do it in Two Move
    omrishilton
    @omrishilton
    can you write an example? or send me a link?
    jdevillard
    @jdevillard
    yp
    yep , currently doing this ^^
    omrishilton
    @omrishilton
    thanks a lot!
    jdevillard
    @jdevillard
    try this
    {labels : containers[].Labels} | labels[?version]