擅长:python、mysql、java
<pre><code>#!python2
import re
mystring = "owner: uid=rocdsc,ou=People,dc=fcd,dc=test,dc=com, member: uid=absylor12,ou=people,dc=fcd,dc=test,dc=com, member: uid=amslsmith,ou=people,dc=fcd,dc=test,dc=com, member: uid=amis,ou=people,dc=fcd,dc=test,dc=com, member:, uid=null,ou=people,dc=fcd,dc=test,dc=com"
# pattern definition
p = 'uid='
# holds user names
users = []
# split string on a space or a comma, find user id, append to list
for item in re.split(' |,|', mystring):
if item.startswith(p):
users.append(item.replace(p, ''))
print users
</code></pre>