This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
I'm trying to use regex to parse some characters from an order number string. If the order number ends in '00' or '01' I want to parse the string into Order Prefix and Order Suffix fields
Order Prefix Order Suffix
If the order number ends in something other than '00' or '01', I want the entire order number in the Order Prefix field and Order Suffix to be null
Using (.*)(00|01)$ I get the desired results if the order number ends in '00' or '01'...other wise both regex outputs are null
If I make the second group optional using (.*)(00|01)?$ the entire order number shows up in the first output group.
I've attached an example workflow.
Go to Solution.
Go to Solution.
You can use the first regular expression that you made with a formula tool directly following.
Take a look at the attached workflow and let me know if this takes care of your issue!
Try Formula Tool, where
Order Prefix given by
IF REGEX_Match([Order Number], '(^.*)(00|01)$') =-1THEN Null()ELSE [Order Number]ENDIF
Order Suffix given by
IF REGEX_Match([Order Number], '(^.*)(00|01)$') =-1THEN RIGHT([Order Number],2)ELSE Null()ENDIF
Thanks for the quick reply @BrandonB and @RNO2 . Using a formula tool did cross my mind, but I was thinking there was a way to accomplish my goal using just regex tool. This is simply enough though.
@jbone, you are most welcome.
Yes, I also tried just the regex tool, but given the outputs that you wanted (what goes into or not) for Prefix & Suffix, I figured a formula tool was necessary...
Thanks for the question!