MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Volvo on Call

    Scheduled Pinned Locked Moved Solved Troubleshooting
    34 Posts 4 Posters 9.6k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • MZ-BERM Offline
      MZ-BER @MZ-BER
      last edited by

      I got it to work! Finally.

      The whole problem was my licence plate. The regular expression wasn’t able to grab the right groups. Thank you @sdetweil for helping me to investigate.

      S 1 Reply Last reply Reply Quote 0
      • S Offline
        sdetweil @MZ-BER
        last edited by

        @mz-ber how did u fix the regex?

        i would change the 1st capture to
        in the list

        ^([^\(]+)\s  =capture up to but not including (
        

        in the scan = capture 1st 8 chars
        how long is a license number? always 8?

        ^(.{8})\s
        

        Sam

        How to add modules

        learning how to use browser developers window for css changes

        MZ-BERM 1 Reply Last reply Reply Quote 0
        • MZ-BERM Offline
          MZ-BER @sdetweil
          last edited by

          @sdetweil said in Volvo on Call:

          German Number Plates can have the following format:

          ABC-D 123
          
          ABC-DE 12 
          
          AB-C 123 
          
          A-BC 1234
          

          I’m using this regex to get the variations: ^([A-Z]{1,3}-[A-Z]{1,2}\s[0-9]{1,4})\s([\w\s]+)\:\s(.+)$

          strawberry 3.141S 1 Reply Last reply Reply Quote 0
          • strawberry 3.141S Offline
            strawberry 3.141 Project Sponsor Module Developer @MZ-BER
            last edited by

            @mz-ber you are missing some german number plates:

            AB-CD 123E electric vehicles

            AB-CD 123H oldtimer, but probably not relevant because they do not have the digital information :D

            The other exceptions are not relevant for private vehicles.

            Please create a github issue if you need help, so I can keep track

            MZ-BERM 1 Reply Last reply Reply Quote 0
            • MZ-BERM Offline
              MZ-BER @strawberry 3.141
              last edited by

              @strawberry-3-141 True! Good catch! So I guess every variation can also have an E at the end. Do you know if there is a whitespace between the last digit and the E? If it is without a space, this will work:

              ^([A-Z]{1,3}-[A-Z]{1,2}\s[0-9,E]{1,5})\s([\w\s]+)\:\s(.+)$

              strawberry 3.141S 1 Reply Last reply Reply Quote 0
              • strawberry 3.141S Offline
                strawberry 3.141 Project Sponsor Module Developer @MZ-BER
                last edited by

                @mz-ber officially there is no space in between the numbers and the suffix, but I work for a provider of a mobility platform and I can tell you that users frequently come up with their own formats like AB-CD123 (no space) or AB-CD 123 E (extra space).

                Your regex works, but it would also cover some invalid plates like the following in case you want a challenge to improve your regex:

                • AB-CD 0E5E8

                • The number can’t start with a 0

                • The E can only be in the end not mixed with the numbers

                Please create a github issue if you need help, so I can keep track

                1 Reply Last reply Reply Quote 0
                • 1
                • 2
                • 3
                • 4
                • 4 / 4
                • First post
                  Last post
                Enjoying MagicMirror? Please consider a donation!
                MagicMirror created by Michael Teeuw.
                Forum managed by Sam, technical setup by Karsten.
                This forum is using NodeBB as its core | Contributors
                Contact | Privacy Policy