Find numeric value at end of string
Ron Rosenfeld wrote...
....
Then try this formula:
=REGEX.MID(A1,"\b[012]?\d-\d{4}(?=\.xls)")
The expression "\b[012]?\d-\d{4}(?=\.xls)" looks for a string which
starts with the word boundary (after the <space in your example)
followed by some number in the range of 1-12 (with an optional leading zero.
....
This would match 00, 13, 14, . . ., 29, none of which are valid month
numbers. If you truly want to limit this piece just to valid month
numbers, then you need something like
(0?[1-9]|1[0-2])
The most efficent way to learn regular expressions is to respond to
regexp questions in Unix and scripting language newsgroups and enjoy
the feedback.
|