iCalendar binding - event filter

Hi all,

Is there a way to filter out certain subjects instead of containing certain subject? I have an item that contains the time for the next event. However, birthdays (start at 00:00 hrs) or certain subjects (lets call them test 1 and test 2 for simplicity) are to be filtered out.

Because I couldn’t figure it out the filter, my Thing at the moment look like this:

UID: icalendar:eventfilter:Huishouden:calNext
label: CalNextEventTime
thingTypeUID: icalendar:eventfilter
  maxEvents: 1
  textValueType: TEXT
  datetimeEnd: 24
  refreshTime: 15
  datetimeStart: 0
  datetimeRound: false
  datetimeUnit: HOUR
bridgeUID: icalendar:calendar:Huishouden

It looks 24 hrs ahead for the next event.

Have a look at Small Guide to icalendar that may help to understand how the setup of filters works.

Thanks for the reply. I’ve read that post and so far I could only find subjects to include rather then exclude.

As far as I understand expressions according to Regular expressions in Java - Tutorial can be used.
You may try something like

(Title: (?!test [12]))

which will exclude “Title: test1” and “Title test2” but it will include all the others automatically.

Or something like

^(?!est 1$)(?!test 2$)[a-z0-9]+$

which excludes “test 1” and “test 2”

In case you let all items to be excluded start with e.g. X you can define the rule that only those will be shown that do not start with e.g. uppercase letters:

(^Title: [a-z]*$)

My examples all start with Title: and then the real content follows. The expression need to be adapted in case the string does not start with Title:.
To exclude subjects the all would have to fit into one expression.

1 Like

Ok. I saw that but regex is hard :grimacing:
I’ll give it a go. Thanks

1 Like

Provide more detailed information and we can check on how to build the expression.

I have events that consist of xxxx innemen and xxx jarig, the latter sometimes followed by another set of characters (so xxxx jarig xxx. If the title contain either of those words, innemen or jarig, the events should be excluded. The xx are not necessarily the amount of characters, this may vary.

So far, I’ve come up with .*(?!innemen)(?!jarig)$ but that would still include the case of xxxx jarig xxx I think.

Try this one:

^(?![a-z 0-9]*jarig[a-z 0-9]*)(?![a-z 0-9]*innemen[a-z 0-9]*).*$

So far the test results are promising :pray:t2: :clap:t2:
Thanks for all your help!

1 Like

the last expression I posted should cover all cases as long as xxx consists of lowercase letters and numbers. In case xxx also contains uppercase letters A-Z needs to be added inside of the brackets.