Do you know how a rexeg work? ( http://programmers.stackexchange.com/questions/122440/how-do-regular-expressions-actually-work ) For this tiny check (if a string starts with a dollar sign) this is a heavy overkill.