[JDEV] JID Validation using REGEX

Jacek Konieczny jajcus at bnet.pl
Tue Jul 15 03:10:25 CDT 2003


On Mon, Jul 14, 2003 at 08:55:20PM -0700, Chris Mullins wrote:
> Has anyone come up with a RegEx expression to validate a JID? 

It would be veeery large regexp. If it is possible at all.
stringprep should be used to preapare and validate JID,
and the procedure described in stringprep includes:

- Unicode normalization
- case folding
- character mapping
- checking for forbidden and unassigned characters

This cannot be done reasonable with regexpes.

I implemented stringprep with nodeprep and resourceprep profiles 
in my PyXMPP library, but this, written in python, makes things very
slow. I thought about making "shortcuts" for "typical" JIDs (eg. regular
us-ascii characters only) with regexpes, but this would allow simple DoS
attacts in future by sending a lot of valid, but not "typical" JIDs
processing of which would take much more resources that a configuration
assumed.

Greets,
	Jacek



More information about the JDev mailing list