Forum Discussion

JensDeveloper's avatar
JensDeveloper
Contributor II
4 years ago
Solved

Map expression regex

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 ...
  • koryknick's avatar
    4 years ago

    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')