As of now i thought that alpha numeric character is nothing but collection of alphabets and numeric only.
But after reading from here , i understood alpha numeric character will include some of the special character.
is there is any difference between special and alpha numeric character?
16 Answers
The word “alphanumeric” (or sometimes “alphameric”) usually means only the basic Latin letters A to Z and a to z plus the common digits 0 to 9, but may include a few other characters as well. The additional characters are typically other characters allowed in identifiers in some context (such as a programming language). For example, in Perl and in JavaScript, \w matches any alphanumeric character, with the underline (underscore, low line) “_” counted as a letter.
The page linked to in the question says: “In some usages, the alphanumeric character set may include both upper and lower case letters, punctuation marks, and symbols (such as @, &, and *, for example). For languages other than English, alphanumeric characters include letter variations such as é and ç.” This is all up to your definitions and conventions; “alphanumeric” means what people make it mean. But such broad (and varying) definitions are not normal in information technology.
Thus, “alphanumeric” should be expected to corresponding to what [A-Za-z0-9] matches (in common regexp syntax), unless stated otherwise or inferrable from the context.
I think that alpha numeric contains alphabets and numbers both(that may also contain special characters also as you cited above) but special characters are specifically the set containing characters such as @, &, and *.
Collection of alphanumeric characters is totally dependent upon the language you are using. If it is about regex you are talking about, I will like to tell you that for the most basic alphanumeric selection we use \w which includes upper/lower case alphabets, numbers and underscore.
\w stands for "word character", usually [A-Za-z0-9_]. Notice the inclusion of the underscore and digits
similarly
\W is the negation of \w Special characters and Alpha numeric characters belongs to two different sets(categories). The link you specified itself says:
In computers designed for English language users, alphanumeric (sometimes seen as alphameric ) character s are those comprised by the combined set of the 26 alphabetic characters, A to Z, and the 10 Arabic numerals, 0 to 9.
As per this part given in link:
For languages other than English, alphanumeric characters include letter variations such as é and ç.
So it is depending on the usage, few characters can be considered inside this set since they are needed to use in combination with that. For example, It is a simple example. Isn't it ? Here ' and ? have to be used to give its a specific meaning. So the above quoted statement seems to be address this point.
As far as REGEX is concern, we have a predefined set to represents alphanumeric as [A-Za-z0-9], excluding any special characters and \was [a-zA-z0-9_] including _ as a special characters.
The others answers here do a good job of addressing WHAT and alpha numeric is ... but not the reason why it exists.
A significant reason is to enable code across different locales without having to check for character differences between languages.
Another way to think about alpha numeric characters is that they have an accepted sort order in written language. Everyone agrees that a comes before b, but only a few of us know that 9 comes before : and ; comes before < in ASCII.
In Unicode, there are categories Letter and Number, but observe that what we think of as "alphanumeric" might contain cosepoints from other categories, such as a combining acute accent (Combining Mark) as part of é, which are not considered alphanumeric if combined with a symbol. So it's not a simple union of categories any longer.
What we intuitively think of as an alphanumeric character might correspond to a single codepoint in the Letter or Number category, followed by zero or more combining marks. Then we might want to consider letterlike symbols, enclosing marks, combining symbols, and so on.