Jump to content

Does Anyone have a generic regex for name/address?


nakins

Recommended Posts

I'm trying to validate form input that will be written directly into a csv file. I want to have a simple expression that only allows common name and addressing character, like # and @ and . and , and -. But everything I've tried doesn't seem to work. Does anyone have a expression that they use for general name and address validation?

If you want a regex to validate a name and address, that's a very, very tall call. But I think you know it and are asking for a first filter that only accepts certain characters. Is that right? Here is an example:

 

[[:alnum:] .@#-]+

 

It allows alpha-numerical characters, spaces, periods, and the other characters between the brackets. Add any characters you like. If you want to use a backslash you will have to escape it, and possibly other special characters depending on their position in the brackets.

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.