Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- php -a
- Interactive shell
- php > $str="[@Homer Jay Simpson](id:homer) is a good guy.";
- php > preg_match('#(\[@([^\]])())#', $str, $matches);print_r($matches);
- Array
- (
- [0] => [@H
- [1] => [@H
- [2] => H
- [3] =>
- )
- php > preg_match('#(\[@([^\]+])())#', $str, $matches);print_r($matches);
- Array
- (
- [0] => [@H
- [1] => [@H
- [2] => H
- [3] =>
- )
- php > preg_match('#(\[@([^\]+]\])())#', $str, $matches);print_r($matches);
- Array
- (
- )
- php > preg_match('#(\[@([^\]]+)())#', $str, $matches);print_r($matches);
- Array
- (
- [0] => [@Homer Jay Simpson
- [1] => [@Homer Jay Simpson
- [2] => Homer Jay Simpson
- [3] =>
- )
- php > preg_match('#(\[@([^\]]+\])())#', $str, $matches);print_r($matches);
- Array
- (
- [0] => [@Homer Jay Simpson]
- [1] => [@Homer Jay Simpson]
- [2] => Homer Jay Simpson]
- [3] =>
- )
- php > preg_match('#(\[@[^\]]+())#', $str, $matches);print_r($matches);
- Array
- (
- [0] => [@Homer Jay Simpson
- [1] => [@Homer Jay Simpson
- [2] =>
- )
- php > preg_match('#(\([@[^\]]+)\]())#', $str, $matches);print_r($matches);
- PHP Warning: preg_match(): Compilation failed: unmatched parentheses at offset 16 in php shell code on line 1
- Warning: preg_match(): Compilation failed: unmatched parentheses at offset 16 in php shell code on line 1
- Array
- (
- [0] => [@Homer Jay Simpson
- [1] => [@Homer Jay Simpson
- [2] =>
- )
- php > preg_match('#(\([@[^\]]+)())#', $str, $matches);print_r($matches);
- PHP Warning: preg_match(): Compilation failed: unmatched parentheses at offset 14 in php shell code on line 1
- Warning: preg_match(): Compilation failed: unmatched parentheses at offset 14 in php shell code on line 1
- Array
- (
- [0] => [@Homer Jay Simpson
- [1] => [@Homer Jay Simpson
- [2] =>
- )
- php > preg_match('#(\[@[^\]]+())#', $str, $matches);print_r($matches);
- Array
- (
- [0] => [@Homer Jay Simpson
- [1] => [@Homer Jay Simpson
- [2] =>
- )
- php > preg_match('#(\[@([^\]]+)())#', $str, $matches);print_r($matches);
- Array
- (
- [0] => [@Homer Jay Simpson
- [1] => [@Homer Jay Simpson
- [2] => Homer Jay Simpson
- [3] =>
- )
- php > preg_match('#(\[@([^\]]+)\]())#', $str, $matches);print_r($matches);
- Array
- (
- [0] => [@Homer Jay Simpson]
- [1] => [@Homer Jay Simpson]
- [2] => Homer Jay Simpson
- [3] =>
- )
- php > echo $str;
- [@Homer Jay Simpson](id:homer) is a good guy.
- php > preg_match('#(\[@([^\]]+)\]\((id:([^)]+))\))#', $str, $matches);print_r($matches);
- Array
- (
- [0] => [@Homer Jay Simpson](id:homer)
- [1] => [@Homer Jay Simpson](id:homer)
- [2] => Homer Jay Simpson
- [3] => id:homer
- [4] => homer
- )
- php > preg_match('#(\[@([^\]]+)\]\((?:id:([^)]+))\))#', $str, $matches);print_r($matches);
- Array
- (
- [0] => [@Homer Jay Simpson](id:homer)
- [1] => [@Homer Jay Simpson](id:homer)
- [2] => Homer Jay Simpson
- [3] => homer
- )
- php > preg_match('#(?:\[@([^\]]+)\]\((?:id:([^)]+))\))#', $str, $matches);print_r($matches);
- Array
- (
- [0] => [@Homer Jay Simpson](id:homer)
- [1] => Homer Jay Simpson
- [2] => homer
- )
- php > preg_match('#(?:\[@([^\]]+)\]\(id:([^)]+)\))#', $str, $matches);print_r($matches);
- Array
- (
- [0] => [@Homer Jay Simpson](id:homer)
- [1] => Homer Jay Simpson
- [2] => homer
- )
- php > preg_match('#\[@([^\]]+)\]\(id:([^)]+)\)#', $str, $matches);print_r($matches);
- Array
- (
- [0] => [@Homer Jay Simpson](id:homer)
- [1] => Homer Jay Simpson
- [2] => homer
- )
- php > preg_match('#\[@([^\]]+)\]\(id:([^)]+)\)#', $str, $matches);print_r($matches);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement