Hi All ,
need ur help to only extract data using the regex with some use cases as below:
**Use case **
LOREM LS8515, WEN+ FEED, WATER (E570)
LOREM IPSUM 8515
LOREM IPSUM-8515
LOREM IPSUM8515
LOREM IPSUM8515 WATER2570
OUPUT NEEDED : 8515
Guys please note Lorem Ipsum can be any words or symbol thank you
Thank you guys
1 Like
rlgandu
(Rajyalakshmi Gandu)
August 8, 2023, 9:59am
2
@StevenIsRobotOnline
(?<=LOREM IPSUM\s*-*)\d{4}
lrtetala
(Lakshman Reddy)
August 8, 2023, 9:59am
3
Hi @StevenIsRobotOnline
(?<=LOREM LS|LOREM IPSUM-|LOREM IPSUM|LOREM IPSUM )\d+
vrdabberu
(Varunraj Dabberu)
August 8, 2023, 9:59am
4
Hi @StevenIsRobotOnline
Matches= System.Text.RegularExpressions.Regex.Matches(yourstringinput,"((?<=[A-Z]+\s+[A-Z]+\s*\-?)\d+)")
Datatype of Matches is IEnumerable(System.Text.RegularExpressions.Match)
Hope it helps!!
mkankatala
(Mahesh Kankatala)
August 8, 2023, 10:01am
5
Hi @StevenIsRobotOnline
You can use the regular expression to get the required output 8515
System.Text.RegularExpressions.Regex.Matches(yourstringinput.ToString,β((?<=\w+\s+)\d{4})β)
Hope it helps!!
hi @StevenIsRobotOnline
can you try this
system.text.regularexpression.regex.match(β\d{4}β).value
Akshay_B
(Akshay B)
August 8, 2023, 10:07am
7
Hello @StevenIsRobotOnline ,
You can try this:
(?<=LOREM IPSUM\s*-*)\d+
I hope this Helps you.
Regards;)
Guys please note Lorem Ipsum can be any words or symbol thank you
Guys please note Lorem Ipsum can be any words or symbol thank you
vrdabberu
(Varunraj Dabberu)
August 8, 2023, 10:15am
10
@StevenIsRobotOnline
you try mine it works for any context!!
Hi @StevenIsRobotOnline
Matches= System.Text.RegularExpressions.Regex.Matches(yourstringinput,"((?<=[A-Z]+\s+[A-Z]+\s*\-?)\d+)")
Datatype of Matches is IEnumerable(System.Text.RegularExpressions.Match)
[image]
Hope it helps!!
Hi @StevenIsRobotOnline
Matches= System.Text.RegularExpressions.Regex.Matches(yourstringinput,"((?<=[A-Z]+\s+[A-Z]+\s*\-?)\d+)")
Datatype of Matches is IEnumerable(System.Text.RegularExpressions.Match)
Hope it helps!!
Akshay_B
(Akshay B)
August 8, 2023, 10:15am
11
@StevenIsRobotOnline Try with this one :
(?<=.\s -*)\d{4}
adiijaiin
(Aditya Jain)
August 8, 2023, 10:20am
13
Hi @StevenIsRobotOnline
You can use the following code to get the desired output:
[A-Za-z ]*(\d{4})(,|[a-zA-Z]+|\s)
Hope it helps!
Hey,
Try With This Pattern:(?<!(WATER))\d{4}
System.Text.RegularExpressions.Regex.Match(str_,β\d{3,}β)
Hope it will help you!!
mkankatala
(Mahesh Kankatala)
August 8, 2023, 10:43am
16
Hi @StevenIsRobotOnline
Check the below expression
System.Text.RegularExpressions.Regex.Matches(yourstringinput.ToString,β((?<=(^[A-Z]+\s+[A-Z]+)|([A-Z]+\s+[A-Z]+)|[A-Z]+\s+[A-Z]+\s+|[A-Z]+\s+[A-Z]+\-)\d{4})β)
hi im not really familiar with regex ,
so how do i get the output caused when i use it on my script it shows
System.Text.RegularExpressions.MatchCollection
i only need : 8515 in a string as an output
rlgandu
(Rajyalakshmi Gandu)
August 8, 2023, 11:06am
18
@StevenIsRobotOnline
Str_output=System.Text.RegularExpressions.Regex.Match(INputString,β8[0-9]+β).Value
mkankatala
(Mahesh Kankatala)
August 8, 2023, 11:07am
19
Okay @StevenIsRobotOnline
=> Assign -> StrOutput = System.Text.RegularExpressions.Regex.Match(yourstringinput.ToString,β((?<=(^[A-Z]+\s+[A-Z]+)|([A-Z]+\s+[A-Z]+)|[A-Z]+\s+[A-Z]+\s+|[A-Z]+\s+[A-Z]+\-)\d{4})β).Value
Store the Input data in a String variable and in above expression pass the variable in the place of yourStringinput place.
The StrOutput is also a String Variable.
Hope you understand!!
mkankatala:
=> Assign -> StrOutput =
Hi Its working now but still not perfect
it still have missing value
the use case is this
1.WILDUN DUMA 8515 β 8515
2. WILAN DC1218 β 1218
3. WILAN DC0818H ->0818
4.WILEN DC1218H ->1218
5. WIILENUN EN997, RSPO MB, GEM+ FOOD, FEED (E436) ->997
THANK YOU