I need regular expression to check whether square bracket [] containing alphpnumeric characters exists in string. Bracket should be after Subject:
word.
sometext..Subject: Auto Reply Re: Some information, anything [0000] continue with anything
I have regular expression as preg_match('#\\[(.*?)\\]#', $text, $match); print $match[1];
preg_match('#\\[(.*?)\\]#', $text, $match); print $match[1];
It should return 0000
as output
This will find "subject" and capture the following contents of a square bracket.
$text ="sometext [1111] ..Subject: Auto Reply Re: Some information, anything [0000] continue with anything";
preg_match('#Subject.*?\[(.*?)\]#', $text, $match);
print $match[1]; //0000
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.