I have an data which may vary in each other place like Qty-35 or 35 Cpy or 35, I need to extract the only numbers from this data please help me in providing the appropriate Syntax or Regular Expression in extracting only the number.
string v1 = “Qty-35 or 35 Cpy or 35”
assign v1 = System.Text.RegularExpressions.Regex.Match(v1,“\d+”).value
you can get result 35
Actually these data whichever mentioned is in the body of the mail and it may be like
Norton Callen’s Ultrasonography in Obstetrics and Gynecology:
First South Asia Edition
Qty - 34
in one mail body and
Whereas,
Basic Immunology : Functions and Disorders of the Immune
System (First South Asia Edition PB—Abbas— 1 copy
In another mail body.
Please help me in extracting only the number
This Regex pattern will give you numbers only : \d+
Regex.Match(your_Mail_body_String, “\d+”).Value
\d with + quantifire Matches between one and unlimited times, as many times as possible, giving back as needed by following greedy approach
Regards…!!
Aksh
Hi,
I want to extract specific value from mail body
9788131247006Norton Callen’s Ultrasonography in Obstetrics and Gynecology:
First South Asia Edition
Qty - 34
Need urgent delivery for this order.
Out of this mail body I need to extract quality value
Output should be
o/p:
34.
Please help.
It is Duplicate so Merged.
Question is here it is an Assignment?
-You should try it by yourself it will be beneficial for you only. A humble advice
and other thing Number you want always after Qty Field?
or you just wants any number like 34,9788131247006?
Regards…!!
Aksh
I want always after Qty Field.
Regards
Sruthilaya
Try this:-Regex_For_number.xaml (5.8 KB)
Regards…!!
Aksh
thank you its working fine.
@aksh1yadav its not always Qty it might be quantity or copy or copies or cps
for this how can i do.
That is where i am stuck ryt now. I need some help badly
This regex will select every number after SPACE DASH SPACE " - "
on the same line:
(?<= - )\d+
This regex will select every character:
(?<= - ).+
(in case you need to match after a comma or dot)
For reference, see it here: