I think your Regular Expression is unnecessarily complex.Indeed it is, but it does give the specified output in the root node.
Besides it chokes on a string like this: "sp Hello there! spelling spoiler spooky asp wizard! sp \n Hey hey sp How are you? sp".Unfortunately so which is why I recommended it to be made more generic (i.e not rely on space being around 'sp').
A simpler and better solution would beThat would be nice but unfortunately it gives this incorrect output
As outlined below it's splitting the string on 'sp' as opposed to grabbing the text between it (as though the first 'sp' were a <sp> and the second a </sp> and so on)$VAR1 = [ '', ' Hello there ', ' Hey hey ', ' How are you? ' ];
01 2 3 sp Hello there sp \n Hey hey sp How are you? sp
_________
broquaint
In reply to Re: Re: Re: Regular expressions
by broquaint
in thread Capturing text between literal string delimiters (was: Regular expressions)
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |