06-14-2022 07:49 AM
Hi,
A simple one for the people that are expert in regex. I’m still learning it.
So, I have a key: notes that contains a value : “#IF:SLG-01-SL + some text here”
My goal is to always get the 9 characters after an ‘#IF:’
My expression I tried in the regex and works: ([#IF:])(.{0,12})
But how do I put it into a mapper?
First i check whether the notes contains ‘#IF:’ if thats true it goes to the path where i need to do the regex in the mapper
$notes.replace($notes, /([#IF:])(.{0,12})/g)
but now it gives the string of the regex.
Regards
Jens
Solved! Go to Solution.
06-15-2022 04:35 AM
It’s the newline character in the string that is causing the issue. The dot notation for character matching in regex does not match newlines. After a bit of thought, we can also simplify the result by using the regex group capture syntax. Try this:
$notes.replaceAll('\n','').replace(/.*#IF:(.{9}).*/g, '$1')
06-15-2022 04:43 AM
Thank you it works now. I get it now. Still improving my regex 🙂
06-15-2022 07:21 AM
Thank you @JensDeveloper for raising this, I got to learn something new as well.
@koryknick and @siwadon’s suggestion and help on this one has been much appreciated.