Start a new topic

RegEx to convert Age to Year of Birth

Hello everyone, I am new to this and have a data file that contains people's ages. I'm wondering if there is a way to convert an age to the year of birth so that it can be mapped to the DOB field in RE. e.g., this year (2019) minus age (65) = 1954. 

Also, is there a place where I can learn how to write custom regular expressions? I am having trouble finding information on this. 

Lindy, I do not think regex expressions perform math calc's.  Here's one way to do it (note: this is not tested and is simply as I type this message 'xx' is whatever column their age is and zz is whatever column you want the year returned).


of course, there is some defensive checking you could do.

obviously the above is not tested as you should '.value' at the end of each import.fields;


Thank you so much, Dennis. I haven't had a chance to try your solution, but your initial comment that regex expressions do not perform math calculations turned my attention to the data source and I realized that I could just as easily use Excel to perform the calculations before I do the import. That way the year is ready to be mapped. This is not ideal as I have to remember to do this each time before I run the import, but it is a workaround if all else fails. I Googled regex and see that there is a lot to learn. Thanks again. 

Lindy, massaging the data in excel prior to the import will certainly do the trick!

Login or Signup to post a comment