Vicky_K
(Vicky K)
October 4, 2022, 7:22pm
1
I have a paragraph like,
“Vicky is going to shop
And he bought apple for 1kg
The price $10
In price : (A to Z) he sell $12”
Here,
In price : (A to Z) he sell is constant
The amount will be dynamic.
I need to extract the amount $12
What is the Regex expression I need to use here
Hi @Vicky_K ,
You can use this pattern.
(?<=In price \: \(A to Z\) he sell).*
Kind Regards.
@Vicky_K @omer.ozturk
I just did a minor update on Omer’s regex. I included the space character after the words “he sell”. So that it will just pick only $12 and not include the space before it.
Here’s the updated regex:
(?<=In price : (A to Z) he sell ).*
Kind regards,
Kenneth
Gokul001
(Gokul Balaji)
October 5, 2022, 4:31am
4
Hi @Vicky_K
You can try with Regex Expression
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=In\sprice\s:\s\(A to Z\)\she\ssell\s)(\D.+)").Tostring
Regards
Gokul
Hello @Vicky_K
Try this regex pattern
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=\(A\sto\sZ\)\she\ssell\s)[\W\d]+").Tostring.Trim
Regular expression tester with syntax highlighting, explanation, cheat sheet for PHP/PCRE, Python, GO, JavaScript, Java, C#/.NET, Rust.
hI @Vicky_K
Try this split alternative too
Split(txt,"In price : (A To Z) he sell")(1)
Split(txt," ")(Split(txt," ").Count-1)
Regards
Sudharsan
@Vicky_K try this regex
“(?<=In price : (A to Z) he sell)[$0-9\s]+”
Regards
Sreejith S S