Advertisement
Guest User

Untitled

a guest
Jun 25th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. $input = 'あいうえお[aiu]';
  2.  
  3. $regexp = '/[[^]]*]$/m';
  4.  
  5. $output = preg_replace($regexp, '', $input);
  6.  
  7. [[^]]*]$
  8.  
  9. $output = array_shift(explode('[', $input));
  10.  
  11. if (preg_match('/^[^[]*/m', $input, $matches)) {
  12. $output = $matches[0];
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement