Raised This Month: $12 Target: $400
 3% 

Restrict Names 1.2a


Post New Thread Reply   
 
Thread Tools Display Modes
Nalled
Junior Member
Join Date: Mar 2004
Old 12-15-2005 , 04:21  
Reply With Quote #51

I've been trying now for two days to get a regex right, but to no succes. I've read the regex link provided a page back, so please dont tell me to read it.

What I want to achieve is to check that a player have at least 2 characters in ther nick, eg <<jj>> should be ok, <<j.j>> should also be ok, but !!j!! not. The best possible solution i figured out was:

?<!((\w){0,1})

But that dident work .....

Someone have a clue ?

EDIT: I think I found a solution at last: ^[\W]{0,}[\w]{0,1}[\W]{0,}$
Nalled is offline
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 12-15-2005 , 06:50  
Reply With Quote #52

so you want 2 word chars with any non-word chars in the middle

Code:
\w[\W_]*\w
that should do it, let me know. BTW you are making this way harder than it is
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 12-15-2005 , 09:50  
Reply With Quote #53

Quote:
Originally Posted by Nalled
What I want to achieve is to check that a player have at least 2 characters in ther nick, eg <<jj>> should be ok, <<j.j>> should also be ok, but !!j!! not.
I really have little idea what you're trying to accomplish.

Do you mean that you want names to have at least 2 different characters in it? Or do you mean that the length of the name must be at least 2 characters long? Or something else entirely?
Brad is offline
Nalled
Junior Member
Join Date: Mar 2004
Old 12-15-2005 , 09:55  
Reply With Quote #54

Quote:
Originally Posted by jtp10181
so you want 2 word chars with any non-word chars in the middle

Code:
\w[\W_]*\w
that should do it, let me know. BTW you are making this way harder than it is
Thanks, I did test it.

But it seems to match everything that has more than two word-chars. So in principle it's the inverted regex I'm looking for.

Code:
((((ii)))) was renamed because "ii" matched regex #40, "\w[\W_]*\w" (Test)
((((i_i)))) was renamed because "i_i" matched regex #40, "\w[\W_]*\w" (Test).
And yes I have a tendency to make things hard

But I think this will do the trick:

^[\W]{0,}[\w]{0,1}[\W]{0,}$

When testing it it seemed to work ok. It rename players with only none-word chars and players with none-word chars and only 1 word-char. And when looking at it, it seems to be the inverted of yours
Nalled is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 12-15-2005 , 10:11  
Reply With Quote #55

Please answer my question.
Brad is offline
Nalled
Junior Member
Join Date: Mar 2004
Old 12-15-2005 , 15:55  
Reply With Quote #56

Quote:
Originally Posted by Brad
Please answer my question.
Sorry, posted my former post at the same time you posted yours so i dident see it.

Its realy complitary to the rules of 2-33 chars in a nick. But those rules just check how many chars there are, and we have a rule at our community which states that ones nick should at least contain 2 letters or digits. So a nick whish is approved by the counting rules, eg "(())" would fail if there isnt at least two chars in it, or digits for that matter. So what I was looking for was some kind of regex that counted the letters and digits and considered 1 or less as a match.

"|--------> 1" Should match because it has only 1 digit or word (/w)
"|--------> 42 <-------|" Should not match because it has 2 or more (/w) in it.
"|----4----><------2---|" Should not match either.

Hmm, I hope I was a bit clearer this time. I think I have solved it by this regex ^[\W]{0,}[\w]{0,1}[\W]{0,}$ though, but im not completly sure.
Nalled is offline
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 12-15-2005 , 22:35  
Reply With Quote #57

oh duh... yeah I made it match what you want to pass the test, I was thining backwards. I will edit this post in a few mins when I figure it out.

----

your last example is right, but its more complicated than it needs to be

Code:
^[\W_]*\w[\W_]*$
also I added in the _ in a char class because \W does not include _
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
Nalled
Junior Member
Join Date: Mar 2004
Old 12-16-2005 , 06:07  
Reply With Quote #58

Quote:
Originally Posted by jtp10181
oh duh... yeah I made it match what you want to pass the test, I was thining backwards. I will edit this post in a few mins when I figure it out.

----

your last example is right, but its more complicated than it needs to be

Code:
^[\W_]*\w[\W_]*$
also I added in the _ in a char class because \W does not include _
Thank you very mush, dident know the _ dident match in /W. That works very well for my needs.
Nalled is offline
BoK | Krazy
Member
Join Date: Dec 2005
Location: Dayton, OH
Old 01-29-2006 , 19:09  
Reply With Quote #59

Could I get regex help with these two commands

r+[a4@]+p+[e3]
because some guy came on with the name "GrapeVine" and it kicked him. So how could I make this not kick for a word like grape.

s+[e3]+x
because some guy came on with the name "Sexy Knife" and it kicked him. And that is really not a bad name.
__________________
BoK | Krazy is offline
Send a message via AIM to BoK | Krazy
jtp10181
Veteran Member
Join Date: May 2004
Location: Madison, WI
Old 01-30-2006 , 06:37  
Reply With Quote #60

require those ot be thier own words, use the word boundry special char on them

Code:
\br+[a4@]+p+[e3]\b
\bs+[e3]+x\b
__________________
jtp10181 is offline
Send a message via ICQ to jtp10181 Send a message via AIM to jtp10181 Send a message via MSN to jtp10181 Send a message via Yahoo to jtp10181
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:47.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode