27 Feb 2012 at 11:50 #1 Izi Izi Soldato Joined 9 Dec 2007 Posts 2,718 Anyone fancy helping me with some regex? I need to match "1d 1h 1m" Where the user could just enter 1m or 1h or 1d or a combination of the three. The numbers can change for example 2d 5h 24m. I hate regex.
Anyone fancy helping me with some regex? I need to match "1d 1h 1m" Where the user could just enter 1m or 1h or 1d or a combination of the three. The numbers can change for example 2d 5h 24m. I hate regex.
27 Feb 2012 at 12:14 #3 Izi Izi Soldato OP Joined 9 Dec 2007 Posts 2,718 Spunkey said: Code: \d+d \d+h \d+m http://regexr.com?30512 Regexr is a great site for messing around with regex. Click to expand... cheers Spunkey - used this site before. I should have said, it wasn't this part that was a struggle. It was the either or part. I.E still matching: 1d or 60m or 1d 50m etc. Is this possible?
Spunkey said: Code: \d+d \d+h \d+m http://regexr.com?30512 Regexr is a great site for messing around with regex. Click to expand... cheers Spunkey - used this site before. I should have said, it wasn't this part that was a struggle. It was the either or part. I.E still matching: 1d or 60m or 1d 50m etc. Is this possible?
27 Feb 2012 at 12:51 #5 Izi Izi Soldato OP Joined 9 Dec 2007 Posts 2,718 Great, thanks! that was easier than I thought.