How to split and extractt order number from text?

Hi , I am new to this group, i have an issue regarding splitting the order number from a random text.

for example: "This is regarding your order number: 123432
customer mobile number: 9876543210.
Please check and confirm the number, Thanks."

Please note that the order number will be mentioned as either “Order Number” or “order number”
some times the order number will be in 2nd line or in 4th line or anywhere in the text.
can anyone help me with this??

@Sharu_Wampire Can you Check this Workflow :
RegexFind.xaml (5.2 KB)

2 Likes

store entire string in variable named variable1
use assign activity : OrderNumber = variable1.substring(variable1.indexOf(“order number:”),6)

Assuming, order number is always six digits. Modify according to test results.

1 Like

Use regular expression with properties-
Input: Your text
Pattern: “(?<=order number:).*”

2 Likes

@supermanPunch thanks for your response, this works fine but what if there is some other names instead of order number?? the value doesnt change but there is possibility that name of the value might change for different scenarios. please help. Thanks

@Sharu_Wampire What are the other Possible Names that it can have?

1 Like

You can specify the other possibilities in or condition within regex pattern, like
“(?<=order number:|ord No:|OR NO:).*”

or

if you are sure of the pattern of the order number (ex: Order number starts with two letters and then 5 digits) and the occurrence (will be specified at the top), then you can write regex pattern to match only the order number and not refer the adjacent elements
“[A_Za-z]{2}[0-9]{5}”

2 Likes