-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Dynamic Replacement Text #10
Comments
hi @rbwest, I saw your issue and forgot to comment on it, sorry. I like that idea, but I have to verify if all of it can be implemented as expected. Especially allowing users to define a function always comes with the question if this is possible without using eval. I'll look into it. |
I added some functionality inspired by that:
|
Hi @svrnm , thanks for adding this! This sounds like exactly what we were looking for. |
Awesome, I added it into the dev release already: https://bit.ly/demomonkey-dev you can play around with it and give me feedback, I plan to put it into the stable release asap. |
@svrnm Got the chance to play around with the dev branch and I'm a bit confused at one piece. I can specify the hash function in a !replace as follows:
Or I can use a random variable as follows:
But I can't seem to combine the two approaches. What I was expecting was something like the following:
I would like to be able to provide a regex pattern and replace any match with a unique hash based on the contents of the match. Am I making a syntax error here using the regex + replace function or is this not possible? |
Ok, so your goal is to have a way to match any email address on a website and replace it with its hash? As of now you can not access groups matched by a regular expression or use regular expressions freely as replacement pattern. That would definitely be a great improvement, but I have to see how difficult it is to get this working (the solutions I created where low-hanging fruits) |
Got it. Yes, ideally I would like to be able to use regex match patterns to replace any match on a page with one of the functions you've added. Sorry if that wasn't initially clear. Still really appreciate the additions. Thanks! |
Ok, let's leave this open for now then. |
My org has been using Demo Monkey for a bit now and we've come across a feature we would love to see added to Demo Monkey. We would like the ability to assign dynamic replacement text through some sort of user definable function rather than being limited to static replacement text.
To elaborate, we are trying to replace email addresses with randomized strings that look like hashes. So for example, we could use the following:
!/(.+)@(.+).(.+)/i=XXXXXXXXXXXXX
This would of course turn "ryan.west@pendo.io" or "severin.neumann@altmuehlnet.de" or any other email to "XXXXXXXXXXXXX", but we would like the replacement to be dynamic hash based on the contents of the email. So "ryan.west@pendo.io" could be replaced with something like "32c84e61df0567e09164fbe11511b08b" instead. The way I envision this working is Demo Monkey users would be able to define a function in their script and then use that function as the return value throughout their script:
!function hash(match) { ... }
!/(.+)@(.+).(.+)/i=!hash(match)
The text was updated successfully, but these errors were encountered: