I have the following string in an attribute: "Jan 1 1960; Jan 1 1900; Jan 1 1960; 01/05/1890; Jan 1 1960; Jan 1 1960; Jan 1 1960; Jan 1 1960; Jan 1 1960; Jan 1 1960; " I need to extract the earliest year from the attribute, since this is input from a reader the attribute will have different values, but the year will always be in a 4 digit format. I want to use a regular expression to extract the earliest year, in this case it would be 1890. Is this possible?
Solved
Regular Expression to extract the earliest year from Attribute
Best answer by david_r
Here's one way:
- StringSearcher with a regex like "\\d{4}" to extract all occurrences of 4 consecutive digits. Specify a list name for all the "All matches list name"
- ListSorter in ascending numerical order on the match list
- ListIndexer on item 0 to extract the lowest number
Example:
Reply
Rich Text Editor, editor1
Editor toolbars
Press ALT 0 for help
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.