I have to get any text between:
Final-Recipient: RFC822; !HERE! Action
I need !HERE! from this example. There could be any string.
I tried something like:
$Pattern = '/Final-Recipient: RFC822; (.*) Action/';
But it doesn’t work.
upd
Here is the string I’m trying to parse: http://dpaste.com/187638/
Your pattern works fine for me:
Output:
Note also that your pattern will fail if the “any text” contains new lines. Use the DOTALL modifier
/.../sto allow the dot to also match new lines. Also note that if the text ” Action” appears elsewhere in the message it will cause your regular expression to fail. Matching dot is dangerous. Try to find a more specific pattern if possible.