Start a new topic

Can a dictionary entry return part of a field?

Greetings All!

I'm trying to use a regex to grab the first 4 characters from a field.


My data would look like:

CMSS-MAJ

SOWK-OAS

SCIE-MAJ

MGMT-OAS

etc.


I would like to extract the first 4 characters and return that as the new value. I have the regex that returns the first 4 characters: ^[A-Za-z]{4}, but I cannot seem to get it to return the 4 characters!?

Needless to say, I'm new to Import-o-matic!

Thanks,

Norm


OK, I figured it out. I thought I would post my solution just in case someone else had a similar problem.

I was approaching it from the wrong angle. I wanted to remove all characters from the "-" on, so in the Replacement Values, I chose BLANK, and then used \-.* in the "Values to match on". Presto chango - it worked!
Hi Norm,

What you need to do is group what you want to return with parentheses and then reference them with $1, $2, etc.

For your case the return value would be $1 and the value to match ^([A-Za-z]{4})(.*)
or you could do that!
Login or Signup to post a comment