username regex help

How to do...

username regex help

Postby leonardinux » Tue Nov 03, 2015 11:23 pm

Hi to all.
I've setted up a Mumble server on Raspberry for a local Amateur Radio community. Each Amateur Radio Operator have a worldwide unique callsign following these rules:
([A-Z]{1,2}|[0-9][A-Z])[0-9]{1,5}[A-Z]{1,9}
I need to put this rules as a regex for username field in mumble-server.ini but every try failed.

Can anyone help me?

Leonardinux
leonardinux
 
Posts: 2
Joined: Tue Nov 03, 2015 11:15 pm

Re: username regex help

Postby fwaggle » Wed Nov 04, 2015 6:15 am

You probably need to escape some of the special characters, and the worst part is that some of them need to be escaped twice if you paste them into a .ini file. I didn't think any of the characters you use require that though.

First of all though, what do you mean by "failed"? Does it simply not enforce them? Or does it not allow any new username after that point?
Full disclosure: I used to run a commercial Mumble host, and my opinions do not reflect the opinions of the Mumble project.
Avatar is stolen from here
User avatar
fwaggle
Team member
Team member
 
Posts: 218
Joined: Tue Oct 06, 2009 10:40 pm
Location: Australia

Re: username regex help

Postby leonardinux » Wed Nov 04, 2015 5:31 pm

The regex works fine in other perl software I've made for personal use.
In username field in the mumble-serve.ini file it doesn't seems to work.
Any attempt to connect to mumble server is refused: "username invalid"
So I think I had to use another syntax... but what syntax have I to use?

Leonardinux
leonardinux
 
Posts: 2
Joined: Tue Nov 03, 2015 11:15 pm

Re: username regex help

Postby fwaggle » Sat Nov 07, 2015 5:26 am

Sorry about the delay - there's nothing wrong with your regex... the problem lies in the parser for Murmur.ini. If I paste your regex directly in to a script that sets it via Ice, it works as expected. However, setting it through the .ini doesn't work, as you said.

So I spent some time playing with it, and it turns out this works:

Code: Select all
username="((?:[A-Z]{1,2}|[0-9][A-Z])[0-9]{1,5}[A-Z]{1,9})"

I don't think the outside set of parenthesis is necessary, and I'm not sure whether setting the first either/or group being made non-matching matters. If you like, you can try just wrapping your original regexp in quotes and seeing if it works as expected, but I didn't think of that before blowing away my test server. :(

When I use the line pasted above, and restart the server (note that kill -hup doesn't reload configuration in Murmur, it only closes and re-opens log files), I am unable to connect with "fwaggle" or "FWAGGLE" but I am able to connect with "FW4GGLE".

Hope that helps. I'll update some examples on the Wiki.
Full disclosure: I used to run a commercial Mumble host, and my opinions do not reflect the opinions of the Mumble project.
Avatar is stolen from here
User avatar
fwaggle
Team member
Team member
 
Posts: 218
Joined: Tue Oct 06, 2009 10:40 pm
Location: Australia


Return to Usage

Who is online

Users browsing this forum: No registered users and 3 guests

cron