Using regex with event listener path | Community
Skip to main content
TheBigRed
Level 4
Feb 4, 2016 7:59 PM UTC
Solved

Using regex with event listener path

Can you use regex for the path which custom event listener listens to?

I'm trying to listen to a folder named 'video' which is a subfolder of a folder which has other siblings (siblings have subfolder called 'video' as well).

I don't want my onEvent function to occur on other folders but just that video folder.

Essentially like this: /content/dam/parentfolder/subfolder/video

I want to do this : /content/dam/parentfolder/.*/video

Is this possible?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
smacdonald2008
smacdonald2008Accepted solution
Level 10
Feb 4, 2016 8:50 PM UTC

Looking at the Javadoc for the ObservationManager manager: 

Parameters:
listener - an EventListener object.
eventTypes - A combination of one or more event type constants encoded as a bitmask.
absPath - an absolute path.
isDeep - a boolean.
uuid - array of UUIDs.
nodeTypeName - array of node type names.
noLocal - a boolean.

 

Looks like you need to specify an absolute path. 

Hope this helps! 

 

 

3 replies

New Participant
Jul 6, 2018 11:21 AM UTC

smacdonald2008​, As per the API of observation manager, we can't use regular expression as path while adding the event using Event Listener.

Is there any other way of adding regular expression path except event handler(we can use regular expression path).

Use case : I want to trigger event for all locale and countries  /content/google/en/us/home ->  /content/google/*/*/home

Translate
TheBigRed
TheBigRedAuthor
Level 4
Feb 4, 2016 9:27 PM UTC

thanks!

Translate
smacdonald2008
smacdonald2008Accepted solution
Level 10
Feb 4, 2016 8:50 PM UTC

Looking at the Javadoc for the ObservationManager manager: 

Parameters:
listener - an EventListener object.
eventTypes - A combination of one or more event type constants encoded as a bitmask.
absPath - an absolute path.
isDeep - a boolean.
uuid - array of UUIDs.
nodeTypeName - array of node type names.
noLocal - a boolean.

 

Looks like you need to specify an absolute path. 

Hope this helps! 

 

 
Translate