Find an id string that is NOT 36 characters long or contains invalid characters?

Find an id string that is NOT 36 characters long or contains invalid characters?

8
NewbieNewbie
8

    Jan 09, 2014#1

    Hi,

    I am trying to validate some XML files that contain many strings like this:

    <Phrase id="e76a7a36-27cb-4d4a-abbf-a17e009a3b4f"

    The ID between the quotes should always be 36 characters long, but I had an instance recently where one of them was longer.

    What I would like to do is run a search to find any Phrase ID that is not 36 characters.

    I can find 36 characters easily enough: <Phrase id=".{36}"

    But how do I say More or Less than 36?

    I'm using UltraEdit 16.10.0.1028 and my preferred regex engine is Perl (but I'm happy to accept a solution in any engine).

    ... or better still:
    Is it possible to search for NOT 36 characters but all characters must be valid hex or dashes?

    Thanks

    6,675585
    Grand MasterGrand Master
    6,675585

      Jan 09, 2014#2

      It looks like search string <Phrase id="(?:[^"]{0,35}|[^"]{37,}|[0-9a-f\-]*?[^"0-9a-f\-].*?)" is what you need, a non marking OR expression.

      [^"]{0,35} ... matches identifier strings with less than 36 characters.
      [^"]{37,} ... matches identifier strings with more than 36 characters.
      [0-9a-f\-]*?[^"0-9a-f\-].*? ... matches identifier strings with 36 characters, but at least one character is whether a hexadecimal character nor a hyphen.
      Best regards from an UC/UE/UES for Windows user from Austria

      8
      NewbieNewbie
      8

        Jan 09, 2014#3

        That's perfect!
        Thanks very much :)