<?php
$string = "username............: username
home directory......: 00/username
mail storage server.: mail-server.example.net
status..............: active
quota size..........: 1000.000 megabytes
quota count.........: no quota
forward to..........: username@example.com
full name...........: testing:testing
offers..............:";
preg_match_all('/\s*(?<key>[^a-z ]+)\.*:\s*(?<value>.+)\s*/i', $string, $matches);
var_dump($matches);
- Output for 4.4.6 - 4.4.9, 5.2.2 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- array(5) {
[0]=>
array(8) {
[0]=>
string(23) "............: username
"
[1]=>
string(20) "......: 00/username
"
[2]=>
string(27) ".: mail-server.example.net
"
[3]=>
string(23) "..............: active
"
[4]=>
string(31) "..........: 1000.000 megabytes
"
[5]=>
string(20) ".........: no quota
"
[6]=>
string(33) "..........: username@example.com
"
[7]=>
string(29) "...........: testing:testing
"
}
["key"]=>
array(8) {
[0]=>
string(12) "............"
[1]=>
string(6) "......"
[2]=>
string(1) "."
[3]=>
string(14) ".............."
[4]=>
string(10) ".........."
[5]=>
string(9) "........."
[6]=>
string(10) ".........."
[7]=>
string(11) "..........."
}
[1]=>
array(8) {
[0]=>
string(12) "............"
[1]=>
string(6) "......"
[2]=>
string(1) "."
[3]=>
string(14) ".............."
[4]=>
string(10) ".........."
[5]=>
string(9) "........."
[6]=>
string(10) ".........."
[7]=>
string(11) "..........."
}
["value"]=>
array(8) {
[0]=>
string(8) "username"
[1]=>
string(11) "00/username"
[2]=>
string(23) "mail-server.example.net"
[3]=>
string(6) "active"
[4]=>
string(18) "1000.000 megabytes"
[5]=>
string(8) "no quota"
[6]=>
string(20) "username@example.com"
[7]=>
string(15) "testing:testing"
}
[2]=>
array(8) {
[0]=>
string(8) "username"
[1]=>
string(11) "00/username"
[2]=>
string(23) "mail-server.example.net"
[3]=>
string(6) "active"
[4]=>
string(18) "1000.000 megabytes"
[5]=>
string(8) "no quota"
[6]=>
string(20) "username@example.com"
[7]=>
string(15) "testing:testing"
}
}
- Output for 5.2.0 - 5.2.1
- Warning: preg_match_all(): Compilation failed: unrecognized character after (?< at offset 6 in /in/M05sU on line 13
NULL
- Output for 4.3.11, 4.4.0 - 4.4.5, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
- Warning: preg_match_all(): Compilation failed: unrecognized character after (?< at offset 6 in /in/M05sU on line 13
array(0) {
}
- Output for 4.3.0 - 4.3.10
- Warning: Compilation failed: unrecognized character after (?< at offset 6 in /in/M05sU on line 13
array(0) {
}
preferences:
267.1 ms | 401 KiB | 356 Q