locked
How to validate the given string in regular expression? RRS feed

  • Question

  • User-2144897193 posted

    Team,

    The below strings are examples, i need to validate by regular expression.

    {"AB_AB_Test":"TestValue",....}

    Please help on this.

    Tuesday, May 12, 2020 6:33 AM

All replies

  • User303363814 posted

    You need to know what 'valid' means.  No numbers in string?  Less than 50 characters?  Must start with '{'?  Must have an even number of double quote characters?  No spaces between pairs of double quotes?  Pairs of uppercase letters must be repeated?  There are many, many, many ways to be valid or invalid.

    What are your rules?

    Tuesday, May 12, 2020 6:44 AM
  • User-2144897193 posted

    No spaces.. no repitation... only symbols allowed is _,"",{} 

    Tuesday, May 12, 2020 6:52 AM
  • User303363814 posted

    So your examples were ones that failed?

    Some valid examples

       "{,

       _

       ,

    Some invalid examples

     " {          - not valid because it has a space

      {{         - not valid because of repetition

       a         - not valid because not one of allowed symbols

    Is this right?  It seems very odd.

    Wednesday, May 13, 2020 1:33 AM
  • User1686398519 posted

    Hi,  kaarthikeyan

    • I want to confirm with you if you need a regular expression to match the following characters,and regard curly braces as special symbols to match.

     {"AB_AB_Test":"TestValue",....}

    • Do you mean to match the content in curly braces, this content should meet the regular expression, can you describe it in detail?

    Best Regards,

    YihuiSun

    Thursday, May 14, 2020 10:29 AM