<?php $lines = array( '"^0user1^7" "2"', '"user2" "2"', '"user3" "6"', '"user with spaces" "91"', ); $regex = '#"(?<user>[a-zA-Z0-9\^\s]+)"\s"(?<num>\d+)"#'; foreach ($lines as $line) { preg_match($regex, $line, $matches); echo 'user = '.$matches['user'].', num = '.$matches['num']."\n"; }
You have javascript disabled. You will not be able to edit any code.