Hey all! I’ve run into an issue with my arch nemesis regex. I have a situation where I have a series of links that are all separated by a simple line break. What is happening though is when I extract the links each one gets separated by two lines. So:
link1
link2
link3
become:
link1
link2
link3
Here is a copy of my expression:
{=extractregex({clipboard}, "Start Point ([\w\W]+)\nEnd Point")}
Thanks for any help!
Hi @Peter_Monterubio
This should work:
{formparagraph: name=data; default=
Link 1
Link 2
Link 3}
{datalist=extractregexall(data, ".+")}
{=join(datalist, "\n")}
I used the formparagraph because the forum won't show clipboard data.
All you need to do is replace data
with {clipboard}
in the extractregexall function.
Here's what's happening:
I'm using extractregexall to extract ALL strings inside my text matching the regex pattern.
The dot plus means all characters except line breaks.
The extractregexall puts all the matches in a list. Then I just use the join function to join them by a line break.
Let me know how that works out for you. I'm sure there are other methods, but personally I like using extractregexall to generate a list (in cases like this one), because that opens up options for presenting the content in different ways.