Regular expression to append a value to gitosis.conf file
I need help appending a value to gitosis.conf file using PHP. I'd like开发者_如何学编程 to use regular expression to add a new user to members list. Here's the structure of the conf file:
[group devs]
members = user1 user2
[group admins]
members = user1
[group gitosis-admin]
writable = gitosis-admin
http://www.rubular.com/r/ELSAs8RAGZ Should work, you can then easily rebuild a string using $1
and $2
, you can replace the first .* (in brackets) with the name of the group you want to append to.
精彩评论