I want a regular expression to select text between /x and /, e.g. I'm wanting to look at something like:-
/x This is a load of multi-line text and some more and more /
... and get the three lines of text (with/without the end bits).
However I want it to be non-greedy so that:-
/x Here is some text / and some more /
... will return only the "Here is some text" bit.
So, a simple regular expression like '^/x[^/]*/' gets me what I want.
However, I'm trying to make this a bit cleverer so that embedded / characters don't break it. So the next try is '^/x.*/\n', this works to an extent but it's 'greedy' so giving it the second example means that it returns both "Here is some text" and "and some more".
Is there a way of saying "not /\n", or any other way of saying 'non-greedy'?
This is using PHP regular expression searches.