/([^:]*):?(.*)/s; # Keeping it simple /([^:]*)(?::(.*))?/; # Making it even more analogous. #### grep defined, /([^:]*)(?::(.*))?/;