# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), <s>63</s> <s>61</s> 62 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage) „Uuõª„LLæDl«âDí«JéRʒÅ¿}нõ.;Ðć_ilDć'xQiA6£мÐþQë\7ÝKõQë\þQ}sõÊ* This isn't too easy without regexes.. :/ Can definitely be golfed a bit more, though. +1 byte as bug-fix for inputs like `"u"`, `"l"`, `"LL"`, etc. (thanks for noticing *@Neil*) [Try it online](https://tio.run/##yy9OTMpM/f//UcO80NLDWw@tAjJ8fA4vc8k5tPrwIpfDaw@t9jq8MujUpMOth/bXXth7eKue9eEJLkfa4zNzgKR6RWCmo9mhxRf2HJ5weF/g4dUx5ofneh/eCmIB@bXFh7ce7tL6/9@gwiLNLDHRwNjIwtjCxMw8KTU11djS2NLEyKLUxwcA) or [verify all test cases](https://tio.run/##NU/LSgMxFP2Vko0gdUgmaR64KOIsis6mQkFQkZk6QiHQRYm0i4IbLbgq3etCQahFd7PzAbldueo39EfGJK0Qzj3JOffek/4gy3tFdTNqotr6flZDzVFi59X69qljoLRvjqQpvCbaLuA5gXe7OIL5ye/Mfgzgzv6MV19QRvsJTJeTy55OlpOdYbt3wO3L6hOm8N2GxbmAx2MoPXP38QBKeNit6tUZwqiOMBYOWWw8Eh1K3Em9cnqYBcdQXvMswzSWVDIu8qIoqKKKxVI7mSgZCyaV4A0lCVdCMiEVFVxJB44x3hDUpH4kqtcQlmGmgz0Wh22p3pQ0eNz2bYhtGG02esv35YQQjN0JsKnuvVVo3fdhUhKiD7PcdK/CgH/uaeT/Q3DEvEBiqlmD@yDe465bd9fRCHurt/nGEMwYdPEH). **Explanation:** <!-- language-all: lang-python --> „Uu # Push string "Uu" õª # Convert it to a list of characters, and append an empty string: # ["U","u",""] „LL # Push string "LL" æ # Take its powerset: ["","L","L","LL"] Dl # Create a lowercase copy: ["","l","l","ll"] « # Merge the lists together: ["","L","L","LL","","l","l","ll"] â # Create all possible pairs of these two lists Dí # Create a copy with each pair reversed « # Merge the list of pairs together J # Join each pair together to a single string éR # Sort it by length in descending order We now have the list: ["llu","LLu","llU","LLU","ull","uLL","Ull","ULL","ll","LL","lu","lu","Lu","Lu","lU","lU","LU","LU","ll","LL","ul","ul","uL","uL","Ul","Ul","UL","UL","l","l","L","L","u","u","U","U","l","l","L","L","u","u","U","U","","","",""] <!-- --> ʒ # Filter this list by: Å¿ # Where the (implicit) input ends with this string }н # After the filter: only leave the first (longest) one õ.; # And remove the first occurrence of this in the (implicit) input ÐD # Triplicate + duplicate (so there are 4 copies on the stack now) ć # Extract head; pop and push remainder-string and first character # separated to the stack _i # If this first character is a 0: l # Convert the remainder-string to lowercase D # Duplicate it †¹ ć # Extract head again 'xQi '# If it's equal to "x": A # Push the lowercase alphabet 6£ # Only leave the first 6 characters: "abcdef" м # Remove all those characters from the string Ð # Triplicate it †² þ # Only keep all digits in the copy Q # And check that the two are still the same # (thus it's a non-negative integer without decimal .0s) ë # Else: \ # Discard the remainder-string 7Ý # Push list [0,1,2,3,4,5,6,7] K # Remove all those digits õQ # Check what remains is an empty string ë # Else: \ # Discard the remainder-string þ # Only keep all digits Q # And check that the two are still the same # (thus it's a non-negative integer without decimal .0s) }s # After the if-else: Swap the two values on the stack # (this will get the remaining copy of †² for "0x" cases, # or the remaining copy of †¹ for other cases) õÊ # Check that this is NOT an empty string * # And check that both are truthy # (after which the result is output implicitly)