First, for multiline matching you can use the /s modifier to make . match "\n". The second tool you may want to use is look ahead assertion, which allows you to check that a match is followed by something, without including that something in the match. The logic then becomes "match the shortest string possible, but it has to be directly followed by the next variable". Something like: /my_variable=(.*?)(?=unwanted_variable|\z)/s. Where the ? after the * means "as little as possible".
In reply to Re: Multiline regex
by Eily
in thread Multiline regex
by adrya407
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |