Answer the question
In order to leave comments, you need to log in
Using a regular expression to get an array between two labels
#word1#--start--#word2#word3#dflsjdf#--end--#word4#word5#
Task: Use a regular expression to get an array of words between two marks (start, end) To get
word2, word3, dflsjdf
There can be any number of words.
Answer the question
In order to leave comments, you need to log in
If only with one regular expression, then it can be like this:
/--start--#(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?(?:([^#]*)#)?--end--/
Only now an arbitrary number is no longer obtained, only up to a certain number (here - up to fifty). Well, the result will turn out, let's say, not quite clean - but here it all depends on the language used.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question