regexfiware-orion

Orion doesn't work properly with idPattern


I'm using Orion Context Broker (version 3.12.0), and I created 4 entities with id: Car1, Car2, Car5, and Car10. If I try to get entities with idPattern (v2/entities?idPattern=^Car[1-5]) I get all four entities while I expected only the first three. If I use idPattern = ^Car[2-5] it works as expected.


Solution

  • (Actually this is not a Orion specific question, but a regular expressions question. However, I'll provide an answer anyway ;)

    Note that ^Car[1-5] matches Car10 as Car1 (which matches) is a substring of Car10.

    Using ^Car[1-5]$ you probably would get the desired result.

    You can test it yourself using https://rubular.com