Mabaelst
(Bart Teuwen)
October 15, 2025, 2:34pm
1
For example, I have a string:
Birthday first name last name 1980
I would now like to test this string to see if a word contains “Verj” (birthday). If so, remove this word.
I already have this code:
´´´´
{% set Name = Event.summary
|reject(‘in’,‘0123456789’)
|reject(‘in’, ‘Verjaar’|lower)
|list
|join %}
Where
´´´´
|reject('in','0123456789')
removes the numbers
and now I’d really like to keep only the first and last name.
The problem is: the string can
Birthday first name last name 1980
Birthd first name last name 1980
Bday first name last name 1980
etc.
I wouldn’t know how to solve something like that!
Can anyone help me?
Thanks in advance.
If it always contains the same #words and order, you could split it via space and take the 2n, 3rd, 4th and 5th of the list?
Mabaelst
(Bart Teuwen)
October 15, 2025, 2:45pm
3
Thanks for your reply.
I understand what you mean, but the string could also be first name, last name, birthday, 1980. That’s precisely my problem.
{% set Name = Event.summary
| regex_replace(find='\d|birthday|birthd|bday', replace='', ignorecase=True) | join | trim %}
Mabaelst
(Bart Teuwen)
October 15, 2025, 3:18pm
5
Didgeridrew:
|birthday|birthd|bday
Thanks for your response.
So if someone invents another form of birthday celebration, this won’t work anymore.
I’ll never be able to handle this.
If you put it this way then yes…if you donot know which words appear where and when, how do you expect ‘logic’ to act?
EDIT: you can also not limit it to words starting with ‘b’ else it would filter bill, bob, etc. too. It would help having some sort of stable structure known in order to try (!) and see if any logic applies
EDIT2: maybe this is something for one of the AI integrations? I myself donot use that so cannot help out.
Yeah, if you can’t control the content or the order of what goes into the string there’s no simple way to identify the name portion.
Mabaelst
(Bart Teuwen)
October 15, 2025, 6:45pm
8
I think AI is your best shot (or at least good one and not too difficult), e.g. :
return a table of this data, without words referrring to birthday or year: birthday jane doe 1982 bday frank fox 1990 jake john birth 2001