get all the intermediate strings contained within 2 split strings

Highlighted
New Member
5 0 0

Hello.

Say i have this text within my WYSIWYG:

 

Lorem ipsum dolor sit amet, consectetur adipiscing elit. In hendrerit non quam eget vestibulum. Nulla accumsan dictum massa, id faucibus diam vulputate a. Nam eget eleifend justo. Maecenas sodales nibh id tellus dignissim venenatis. Donec pharetra tortor purus, sit amet dapibus leo laoreet nec. 
[split]12341234[/split]
Duis bibendum porttitor dui. Maecenas fringilla orci ac suscipit mollis. Ut ut ex urna. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos.
[split]845674567[/split]
Ut sit amet quam nec turpis fringilla placerat id nec justo. Phasellus commodo, ante ut lacinia vestibulum, est risus fringilla odio, quis laoreet mi augue et velit.
[split]766767676[/split]

My goal is to extract the numbers between [split] and [/split]

Now, i know that i can do something like: 

{% assign openSplit = "[split]" %}
{% assign closeSplit = "[/split]" %}

{% assign allText = article.content | strip_html | split:openSplit %} 
{% assign allText_2 = article.content | strip_html | split:closeSplit %}

<div class="allText">{{ allText }}</div>    
Count of "{{ openSplit  }}" = {{ allText.size | minus:1 }}.
    
<div class="allText2">{{ allText_2 }}</div>    
 Count of "{{ closeSplit  }}" = {{ allText_2.size | minus:1 }}. 

in order to some part or string, but i cant figure out how to combine the two in order to get:

12341234
845674567
766767676

Does anyone have an idea on this?

Thanks!

0 Likes