Regular expression problem
按键盘手指磨破皮
按键盘手指磨破皮 2017-09-21 01:43:32
0
3
1395
$a = '<img  src="/resource/public/game/2015/4/17/360aae11-78fc-4d91-b016-0995918039a4.gif" width="90" height="90">   
 <img  src="/resource/public/game/1414944000/599afd66-8740-47b6-b935-68d427fa5821.jpg" width="90" height="90">';
 
 
 $b = '/\b\/.+(?=" width\b)/';
preg_match_all($b, $a, $c);

var_dump($c);
array(1) {
  [0]=>
  array(2) {
    [0]=>
    string(72) "/resource/public/game/2015/4/17/360aae11-78fc-4d91-b016-0995918039a4.gif"
    [1]=>
    string(52) "/1414944000/599afd66-8740-47b6-b935-68d427fa5821.jpg"
  }
}

I want to match the picture name, how should I match it?

360aae11-78fc-4d91-b016-0995918039a4.gif

599afd66-8740-47b6-b935-68d427fa5821.jpg

The idea is from the back Match forward to the first/end but I don’t know how to write

in front
按键盘手指磨破皮
按键盘手指磨破皮

reply all(3)
寻觅 beyond

Someone has already answered, let me make a suggestion. I suggest you use the explode() function to convert it into an array, and then use array_pop() to get the picture name

那山

I can’t even understand this

Ty80
$b = '/src=[\'"][^\'"]+\/([^\'"\/]+)[\'"]/';

this

  • reply After further research, I found that this is better $b = '/b/[w-]{20}.+(?=" widthb)/';
    按键盘手指磨破皮 author 2017-09-21 10:34:15
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template