Edited as originally posted at 2am after much frustration. Tidied up.
I'm currently trying to split a string into sections where each array entry starts and ends at == or end-of-string. String should always start with == and terminate with out any special char's at the end. Developing in Angular so code will be TS.
Example text ==key stage 4==
===meaning===
'''visible light''' is an [[electromagnetic wave|electromagnetic wave]] that [[human]]s can see.
===about light===
====properties====
: '''visible light''' is a [[transverse wave|transverse wave]].
: '''visible light''' can travel through a [[vacuum]] as well as through any [[transparent]] [[solid]], [[liquid]], [[gas]].
: the [[speed]] of '''visible light''' through a [[vacuum]] is 300,000,000[[m/s]].
as a [[wave]] [[light]] can be:
*[[transmit|transmitted]]
==beyond the curriculum==
{{#ev:youtube|https://www.youtube.com/watch?v=ixxzrzxafeq}}
Needs to be split into:
1.
==key stage 4==
===meaning===
'''visible light''' is an [[electromagnetic wave|electromagnetic wave]] that [[human]]s can see.
===about light===
====properties====
: '''visible light''' is a [[transverse wave|transverse wave]].
: '''visible light''' can travel through a [[vacuum]] as well as through any [[transparent]] [[solid]], [[liquid]], [[gas]].
: the [[speed]] of '''visible light''' through a [[vacuum]] is 300,000,000[[m/s]].
as a [[wave]] [[light]] can be:
*[[transmit|transmitted]]
2.
==beyond the curriculum==
{{#ev:youtube|https://www.youtube.com/watch?v=ixxzrzxafeq}}
I've tried all manner of expressions.
Currently trying: var h2reOuter = /(?===[w+b(?<!=]*==)/gm;
with little success. I've also tried var h2reOuter = /(?===[^=]*==)/gm;
Using result = str.split(h2reOuter);
But its resulting in splitting on '====' which is not valid.
Once done I will also need to search for the text inside the ==Text==. The above expression does work for this. This swaps in <h2>#</h2>
for ==#== and <h3>#</h3>
for ===#===. Got this working okay but added for context.
Any advice?
Thank you.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…