H2O · Artist Profile

H2O · Artist Profile

On rare occasions, Google surprises you by returning no useful information for your search. Extracting numbers and retrieving all uppercase words from a given string in JavaScript were two such problems. In the latter case, there were all kinds of regex examples to find capitalized words or uppercase letters, but not the uppercase words.h2ob2b In this post we discuss why getting uppercase (or lowercase) words from a string is not that straightforward, and how can we attempt it. Why the complexity? 1 - Numbers - Are numbers uppercase or lowercase? Would you consider 1, 2, 3, 77, B2B, B2C, HBD2U, PS2, H2O, 3G, 4G, 5G, and PS4 uppercase? (Check this thread for scholarly and detailed debate, most of which went straight over my head). Personally, I’d say it’s highly subjective. 2 - Special characters and punctuation marks - Is F.B.I as a whole uppercase? Similarly, FILET-O-FISH or OK! ? 3 - Contraction and double contractions - what about YOU’VE, HAVEN’T, SHOULD’NT’VE, D’Y’ALL? (I guess everyone would agree they should be considered uppercase or lowercase depending on the case of the alphabets) What’s the solution? Again, there’s no right or wrong solution for that. It simply comes down to what qualifies as uppercase for you. For me, a word consisting of contraction, double contraction or alphanumeric qualifies as uppercase if ALL the alphabets are uppercase, and as lowercase when all of them are lowercase. The numbers alone, I believe, are neither upper nor lower case.