I would like you to create some regex to find out if the first number in a set of numbers and letters is a one. For example, in “1 month, 2 days, and 3 hours” the selected text would be “1”. In “1 day, and 3 hours”, it would return “1”. In “5 months” it would return “5”.
Sure thing. You can use Extended Regular Expression and come up with the following expression:
.\*\(\d+\).\*
the previous expression will look for a sequence of digit (a number) preceded by a string that does not contains numbers so that \d+ is the first number encountered.
At this point \1 will contain the number matched by \d+.