In relation to thread: http://www.excelforum.com/excel-prog...wildcards.html and my very first question...
First let me start off by stating as clearly as possible that this thread is concerned solely with the creation of a Regular Expression Pattern ... I am not looking for "alternative" non-REGEX methods.
What I want to do is build a REGEX pattern that will establish as to whether or not a string matching a specified pattern can be found in another cell... the string rules are such:
Thus far I came up with the below (where A1 holds string of interest)Please Login or Register to view this content.
=REGEX.FIND(A1,"(30[0-9]{4}-[0-9]{2})")
Now this is all fine up to the point of the last character... ie the variable 10th Char... given it may or may not exist and where it does it may or may not be numeric.
I need to work out how to alter the Expression to look for a numeric 10th Char but only where Char 10 exists... ie if I change the {2} to {3} in the Expression that FIND will fail as you would expect whereas in reality if Chars 8 & 9 are numeric and no Char 10 exists the FIND should return 1 given it is a valid "ending" for the string in question...
Sample values for which REGEX.FIND should return 0
Sample values for which REGEX.FIND should return 1Please Login or Register to view this content.
I guess I "could" cheat and alter the source String if < 10 chars and append a 0 to the end, ie:Please Login or Register to view this content.
=REGEX.FIND(A1&IF(LEN(A1)<10,0,""),"(30[0-9]{4}-[0-9]{3})")
but I'm guessing there must be a way of doing this using the pattern itself... I'm keen to learn!
TIA
The Donkey
Bookmarks