ChrisOswald
Active Member
- Joined
- Jan 19, 2010
- Messages
- 454
Hi,
I'm needing to extract from an input string a substring that fits a certain pattern. The pattern match I'm looking for is:
1) The substring is 5 characters long
2) The characters around the substring need to be non-alphanumeric (to bias the pattern match fails to false negatives)
3) The pattern is [1-2][0-9A-z][0-9A-z][0-9A-z][0-9A-z]
4) The string should be search from "Back to Front", and if more than 1 possibility is found the hindmost should be returned.
5) There is never more than 2 characters in the substring that are letters. (this is the bit I can't figure out without testing all 11 possible patterns, which is slightly less than elegant)
6) If no pattern match is found, the UDF returns ""
Thanks,
I'm needing to extract from an input string a substring that fits a certain pattern. The pattern match I'm looking for is:
1) The substring is 5 characters long
2) The characters around the substring need to be non-alphanumeric (to bias the pattern match fails to false negatives)
3) The pattern is [1-2][0-9A-z][0-9A-z][0-9A-z][0-9A-z]
4) The string should be search from "Back to Front", and if more than 1 possibility is found the hindmost should be returned.
5) There is never more than 2 characters in the substring that are letters. (this is the bit I can't figure out without testing all 11 possible patterns, which is slightly less than elegant)
6) If no pattern match is found, the UDF returns ""
Thanks,