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.

    Calendar CustomEvents

    Scheduled Pinned Locked Moved Unsolved Troubleshooting
    16 Posts 3 Posters 227 Views 3 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.
    • evroomE Offline
      evroom @daportelli
      last edited by evroom

      @daportelli said:

      https://fossa.com/resources/devops-tools/regex-tester/

      The ‘Regular Expression’ is your ‘search’ from the config line, hence ‘in Hamburg$’.
      The ‘Replacement Pattern’ is your ‘Replace’ from the config line, hence ‘’ (nothing)
      The ‘Test String’ is what is triggered by your ‘keyword’ so in this case ‘Geburtstag in Hamburg’ will trigger the search and replace.

      So, fill in:
      Regular Expression: in Hamburg$
      Test String: Geburtstag in Hamburg
      Replacement Pattern: ‘’

      Then your Match will be ‘in Hamburg’ and your Highlighted will be ‘Geburtstag’ (that what remains white).

      For testing search & replace on https://regex101.com, you will need to choose Function - Substitution on the left side.

      Regular Expression: .in.Hamburg$
      Test String: Geburtstag in Hamburg
      Substitution:
      This will result in: Geburtstag

      This will only match on ‘in Hamburg’, so to make it more flexible you will need to make use of so called grouping:
      Regular Expression: (Geburtstag).+$
      Substitution: $1
      This will result in: Geburtstag

      MagicMirror version: 2.33.0
      Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
      Raspbian GNU/Linux 12 (bookworm)

      Test environment:
      MagicMirror version: v2.33.0
      Raspberry Pi 3 Model B Plus Rev 1.3 (1 GB RAM)
      Raspbian GNU/Linux 12 (bookworm)

      1 Reply Last reply Reply Quote 0
      • D Offline
        daportelli
        last edited by

        Thanks for explaining this in a language I can understand. I got that to work.

        In my calendar I have “amex” typed in lower case and I want the transform it to upper “AMEX” to show this works.

        Screenshot 2026-03-16 090228.jpg

        However when I use the below code on a calendar event that only has an event titled ‘amex’ in lower case does not work.

        {keyword: 'amex', transform: { search: 'amex', replace: 'AMEX'}},
        

        This simple thing is confusing me. I have removed all variables, and it still does not work.

        Thanks again for everyone help.

        S evroomE 2 Replies Last reply Reply Quote 0
        • S Offline
          sdetweil @daportelli
          last edited by

          @daportelli I’m not sure of the effect, but the keyword is treated as a regular expression. I don’t know if single quotes make a difference

          Also don’t know if js regex works the same, from the code

          IMG_5110.png

          Sam

          How to add modules

          learning how to use browser developers window for css changes

          1 Reply Last reply Reply Quote 0
          • evroomE Offline
            evroom @daportelli
            last edited by evroom

            @daportelli

            The comments in the code are very confusing, but I think I get it now, more or less.

            Try this:

            {keyword: '.*', transform: { search: 'Spotify', replace: 'Music'}},
            {keyword: '.*', transform: { search: 'Canterbury-Bankstown Bulldogs', replace: 'Bulldogs'},
            

            The keyword is the event title string you want to change, in format regex.
            The search is the substring that you want to replace, in format regex
            The replace is what will be replaced based on your search

            So in this case, let’s say the event title string is:
            ‘Spotify play list’
            Then you search the complete string (.*) for the substring from search and you replace it by the string from replace.
            Hence, the event title now becomes:
            ‘Music play list’

            I hope it is a little bit more clear.

            Should it not work, then please supply a event title and in short what you want to be replaced.

            MagicMirror version: 2.33.0
            Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
            Raspbian GNU/Linux 12 (bookworm)

            Test environment:
            MagicMirror version: v2.33.0
            Raspberry Pi 3 Model B Plus Rev 1.3 (1 GB RAM)
            Raspbian GNU/Linux 12 (bookworm)

            S 1 Reply Last reply Reply Quote 0
            • S Offline
              sdetweil @evroom
              last edited by sdetweil

              @evroom keyword means find this(via regex) in the title, then work rest of customization . ONLY For events that find keyword string

              .* Means all events

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              evroomE 1 Reply Last reply Reply Quote 0
              • evroomE Offline
                evroom @sdetweil
                last edited by

                @sdetweil said:

                @evroom keyword means find this(via regex) in the title, then work rest of customization . ONLY For events that find keyword string

                .* Means all events

                Yes, it is a double regex, right?
                First look if this an event title that you would like to change, then search for the string you want to replace.
                Still do not understand why the examples from the first post do not work, but for that we would need the exact event titles.

                {keyword: ‘this event’, transform: { search: ‘changed’, replace: ‘modified’}

                Event title: ‘we want this event to be changed’.
                New title: ‘we want this event to be modified’.

                Do you happen to know how to make the keyword case insensitive?
                string/i or m/string/i do not work.
                Neither does (?i)
                which means ‘match the reminder of the pattern with the i modifier.

                MagicMirror version: 2.33.0
                Raspberry Pi 4 Model B Rev 1.5 (8 GB RAM)
                Raspbian GNU/Linux 12 (bookworm)

                Test environment:
                MagicMirror version: v2.33.0
                Raspberry Pi 3 Model B Plus Rev 1.3 (1 GB RAM)
                Raspbian GNU/Linux 12 (bookworm)

                S 1 Reply Last reply Reply Quote 0
                • S Offline
                  sdetweil @evroom
                  last edited by

                  @evroom keyword is not insensitive and cannot be set that way.

                  the search can be

                  Sam

                  How to add modules

                  learning how to use browser developers window for css changes

                  D 1 Reply Last reply Reply Quote 0
                  • D Offline
                    daportelli @sdetweil
                    last edited by

                    @sdetweil to remove as many variables as I can, I have created a reoccuring event called “Spotify” and I want to change it to “Music”

                    Screenshot 2026-03-21 163450.jpg

                    And I have tried the code below with single and double quotes with no success

                    {keyword: '.*', transform: { search: 'Spotify', replace: 'Music'}},
                    

                    For something so simple this is driving me crazy.

                    S 2 Replies Last reply Reply Quote 0
                    • S Offline
                      sdetweil @daportelli
                      last edited by sdetweil

                      @daportelli ok, I just setup an event, happening every day
                      ‘Spotify Event’

                      added the custom event def you showed

                                      {
                                              module: "calendar",
                                              header: "US Holidays",
                                              position: "top_left",
                                              config: {
                                                      customEvents: [
                                                              { keyword:'.*', transform :{ search:'Spotify', replace:'Music'} }
                                                              ],
                                                      calendars: [
                                                              {
                                                                      fetchInterval: 7 * 24 * 60 * 60 * 1000,
                                                                      symbol: "calendar-check",
                                                                      url: "https://ics.calendarlabs.com/76/mm3137/US_Holidays.ics"
                                                              },
                      

                      and got this result
                      Snip20260321_10.png

                      MM 2.34

                      I changed the customEvent definition to

                      { keyword:'event', transform :{ search:'Spotify', replace:'Music'} }
                      

                      and it produced the same resutlts

                      Sam

                      How to add modules

                      learning how to use browser developers window for css changes

                      1 Reply Last reply Reply Quote 0
                      • S Offline
                        sdetweil @daportelli
                        last edited by sdetweil

                        @daportelli Ah, you are using MMM-GoogleCalendar

                        which doesn’t support the text replacement

                        I am talking about the default module:‘calendar’

                        Sam

                        How to add modules

                        learning how to use browser developers window for css changes

                        1 Reply Last reply Reply Quote 0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • 1 / 1
                        • 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