A regular problem.
Asked the next Lao Xu, but the old Xu is very busy recently obviously the news also did not have time to see, then sent to everybody research research
Can match the following two kinds of situations, not one of them ...
Http://www.uploadfr.com/images/2014/03/20/204417dydmmeowem3mlnl0.jpg.thumb0608f2.jpg http://www.uploadfr.com/ Images/2014/03/20/204417dydmmeowem3mlnl0.jpg
------Solution--------------------
/^http://www.uploadfr.com/images/\d{4}/(\d{2}/) {2}\s*.jpg$/
------Solution--------------------
$str 1 = ' http://www.uploadfr.com/images/2014/03/20/204417dydmmeowem3mlnl0.jpg.thumb0608f2.jpg ';
$str 2 = ' http://www.uploadfr.com/images/2014/03/20/204417dydmmeowem3mlnl0.jpg ';
$pattern = '/^http:\/\/www\.uploadfr\.com\/images\/(\d{4}) \ (\d{2})/(\d{2}) \ ([a-z0-9]+) \. (jpg
------Solution--------------------
Png
------Solution--------------------
Gif
------Solution--------------------
JPEG) (\.thumb ([a-z0-9]{6}) \.\\5)? $/';
Preg_match ($pattern, $str 1, $match 1);
Preg_match ($pattern, $str 2, $match 2);
Print_r ($match 1);
Print_r ($match 2);
------Solution--------------------
See if this is the case, because you don't know the accuracy you want to match, write one first.
$content =<<
<>
Word-word word-word character-word-word-word word-word-word-word-word-word-word-word-word-word-word-word-word 204417dydmmeowem3mlnl0.jpg.thumb0608f2.jpg word-word word-word character-word-character http://www.uploadfr.com/images/2014/03/20/ 204417dydmmeowem3mlnl0.jpg word-word word-word character word-word character word-character
TXT;
Preg_match_all ('/http:\/\/www.uploadfr.com\/images\/\d{4}\/\d{2}\/\d{2}\/\d{6}.*?jpg (\.thumb[a-z0-9]{6}\.jpg)? /si ', $content, $matches);
Print_r ($matches [0]);
Don't know dydmmeowem3mlnl0 this you need to match? If we're going to change this,
Preg_match_all ('/http:\/\/www.uploadfr.com\/images\/\d{4}\/\d{2}\/\d{2}\/\d{6}[a-z0-9]{16}\.jpg (\.thumb[a-z0-9 ]{6}\.jpg)/si ', $content, $matches);
------Solution--------------------
1. I didn't get your message.
2, such a rule string ' #http://\s+\.jpg\b# ' Can't you?
------Solution--------------------
References:
1. I didn't get your message.
2, such a rule string ' #http://\s+\.jpg\b# ' Can't you?
He must have had a special request, and he didn't understand.
A question was not clear, the criticism.
------Solution--------------------
There should be no special requirement, except that the first case has a string with a jpg ending
So you can't use non-greedy mode.
Reference:
Quote: Reference:
1. I didn't get your message.
2, such a rule string ' #http://\s+\.jpg\b# ' Can't you?
He must have had a special request, and he didn't understand.
A question was not clear, the criticism.
------Solution--------------------
Show concern