xoops forums

sudhaker

Not too shy to talk
Posted on: 2003/10/15 21:06
sudhaker
sudhaker (Show more)
Not too shy to talk
Posts: 117
Since: 2003/2/6 2
#1

For REGEX GURU



I need to configure XOOPS so that it only allows users with format {name}{year_in_2_digit}{breanch_code}

example -> sudhaker97ec is a valid one

Followings are the list of branch code:
m, c, e, pr, me, ch, ec, mi, cs

If I'll use "\d{2}(m|c|e|pr|me|ch|ec|mi|cs)\z" in "Preferences Main »» User Info Settings »» Enter names that should not be selected as username"

this will filter users exactly what i wish to permit.

I am looking for options other than hacking register.php

Thanx.

sudhaker

Not too shy to talk
Posted on: 2003/10/15 21:07
sudhaker
sudhaker (Show more)
Not too shy to talk
Posts: 117
Since: 2003/2/6 2
#2

Re: For REGEX GURU


Can we NEGATE the regex ??
Posted on: 2003/10/15 22:11
ackbarr
ackbarr (Show more)
Posts: 1449
Since: 2002/10/2
#3

Re: For REGEX GURU

I am not strong with regular expressions, but I think negating the regex should do the trick. I'll have to pull out my copy of Mastering Regular Expressions tonight to see how to do so

Hober

Just popping in
Posted on: 2003/11/7 23:24
Hober
Hober (Show more)
Just popping in
Posts: 40
Since: 2003/6/13
#4

Re: For REGEX GURU

Put this around line 77 of register.php
if ( !preg_match("/^.+[0-9]{2}[m|c|e|pr|me|ch|ec|mi|cs]{1}$/",$uname) ) {
  
$stop .= sprintf("Your username is not formatted correctly<br />");
}