I’m trying to get the string hello world.
This is what I’ve got so far:
$file = "1232#hello world#";
preg_match("#1232\#(.*)\##", $file, $match)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It is recommended to use a delimiter other than
#since your string contains#, and a non-greedy(.*?)to capture the characters before#. Incidentally,#does not need to be escaped in the expression if it is not also the delimiter.Even better is to use
[^#]+(or*instead of+if characters may not be present) to match all characters up to the next#.