regex - get the words between two specific characters in php
How to get the words between the characters "--#" and "#--" I tried regex and explode but I cant get the desired output.
output must be : Section 2, Section 3, Section 4, Section 5 .................................................................................
--#Section 2#-- -##Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt##-
--#Section 3#-- -##Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt##-
--#Section 4#-- -##Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt##-
--#Section 5#-- -##Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt##-
Answer
Solution:
Since the title of the question clearly states:
You can use this regex:
Explanation:
Working Demo
Answer
Solution:
Through sed,
Answer
Solution:
You could try this one:
DEMO
Answer
Solution:
If you use BASH
a simple answer without using sed or any other command is by doing the following