Jump to content

Regex problem


gijew

Recommended Posts

I'm trying to validate as much as I can html color codes that come through. 

What I'm trying to achieve is...
1.  Validate if 6 alpha numeric characters are being sent without the # sign.
2.  If more or less than 6 alpha numeric characters are being sent, default to xxx.
3.  If any other character is being sent other than 6 alpha numeric characters, default to xxx.

End result, no error messages, just defaults unless a valid 6 character alpha numeric string is found.

I know that I'm going about this wrong so I started using some regex again which I suck at.  If you require, I can show what I have.  It's not right, it's not good and it's not clean but it's what I know. 

Can someone help me out with a good search and replace regex here?  Thanks!
Link to comment
https://forums.phpfreaks.com/topic/16148-regex-problem/
Share on other sites

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.