Good day all I have this alphanumeric value that always starts with COMP and followed by 14 numbers:
![]()
This is the structure it takes, looking at the first one. I want to only extract from ‘COMP+14 DIGITS’ anything after that should be stripped off.
Simply use regex-
Assign Activity
extractedValue =
System.Text.RegularExpressions.Regex.Match(yourString, “COMP\d{14}”).Value
Happy Automation
You can use this
System.Text.RegularExpressions.Regex.Match(yourString, “COMP\d{14}”).Value
Alternatively, you can use replace Extra Text ![]()
System.Text.RegularExpressions.Regex.Replace(yourString, “(COMP\d{14}).*”, “$1”)
This will keep only COMP + 14 digits and strips anything after it.
Also with these ones I only want to extract the alphanumeric value and exclude the number in the brackets.
That is only extracting from the first letter up until ‘MV’
Try This – ^ [A-Za-z0-9]+_MV
System.Text.RegularExpressions.Regex.Match(yourString, “[1]+_MV”).Value
A-Za-z0-9 ↩︎
System.Text.RegularExpressions.Regex.Match(yourString, “[1]+”).Value
This will return:
NPU02425S_MV
VAP20007700_MV
MBFS20000726_MV
A-Z0-9_ ↩︎
COMP is always 4 letters and you always want the next 14 digits. So just use Left(yourVariable,18)
This regex should work : COMP\d{14}
I used this:
System.Text.RegularExpressions.Regex.Replace(yourString, “(COMP\d{14}).*”, “$1”)
It worked, thank you
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

