Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    glenveegee
    @glenveegee
    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
    glenveegee
    @glenveegee
    And which box is being validated by that regex
    ^\+\d{2}|[89][0-9]{7}$
    varajgandhi
    @varajgandhi
    image.png
    this field only
    glenveegee
    @glenveegee
    Either <plus> with 2 digits or eight digits starting with 8 or 9
    varajgandhi
    @varajgandhi
    either digits starting with 8 or 9
    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: