Hash_Tag Client side Validation

Hi
anybody help me to find suitable validation way for Hash_Tag, My need is
user should only type hash_tag like below format.
a) #sports
b) #sports,#news

Please Help Me,
Regards,
Manoj.

Manoj M. wrote in post #1113802:

Hi
anybody help me to find suitable validation way for Hash_Tag, My need is
user should only type hash_tag like below format.
a) #sports
b) #sports,#news

There’s not enough information here to really know how to help you, but
the solution will almost certainly involve regular expressions…

So would the following format be invalid in your app?

“Some random text #sports and some more random text #news #football.”

You have not specified enough detail for what you consider valid
hashtags to formulate a workable regular expression.

Manoj M. [email protected] wrote:

Hi
anybody help me to find suitable validation way for Hash_Tag, My need is
user should only type hash_tag like below format.
a) #sports
b) #sports,#news

Did you really mean “Client Side Validation” as you have in your
Subject: line? That means JavaScript, not ActiveRecord validations?
Even if you do use Client Side validation, you really need to do Server
Side as well to guard against hacks. Read about Server Side here:

Follow Robert’s advice as well and learn some regular expression
magic. You’ll need it for either side.

I’m wondering altogether though, why the need to validate this? If the
user is typing a stream of text, they may or may not wish to include #
at some point other than as a hash tag; I think perhaps you maybe just
want to extract the hash tags that match your spec, rather than declare
the input invalid? I’m just speculating here, I obviously don’t know
what your application is trying to do. It’s the concept of hash tags
from twitter and now other services that I’m thinking of; a way to
denote a specific key word to search on in a stream of text.

Anyway, more code/design/info is needed to help more, I think.