hi there. excellent module. but i can't find my way through pregmatch... sorry. can you help me?
i need to check the username for this pattern: say a user's name is Thomas Musterman (i am german too ;) ) i want it to check the username for

t.musterman

(it does not have to check for the real name but just for the pattern "oneLetter dot moreLetters")

thanks!

Comments

Schneck’s picture

Status: Active » Closed (fixed)

hi there,

try [a-zA-Z]\.([a-zA-Z]+)

there are many regext testers out there, like http://www.fileformat.info/tool/regex.htm

bye
stefan

drupalok’s picture

thanks for the quick reply.

[a-zA-Z]\.([a-zA-Z]+) works in the regext test-link you sent me. but it does not work in drupal. (i just put it in the field like that... is that correct?)

it says "Username format is invalid" even if i put "t.musterman"

thank you very much!

Schneck’s picture

ok, this one should work also in preg_match():

/^[a-zA-Z]\.([a-zA-Z]+)$/

For learning regex, i recommend this (german): http://www.amazon.de/Regul%C3%A4re-Ausdr%C3%BCcke-Jeffrey-E-Friedl/dp/38...

bye,
stefan

drupalok’s picture

thank you very much! this works like charm. i promise to learn pregmatch in the next weeks! :)