I only want to get the value 3. What i want to extract is only (in this example) 23 dollars, and the amount can vary and so can the order of the list (Number 1, 2, 3, etc.). So what i want to do is use a reg ex that starts with "Number 3. Amount: ", and trim the rest.
My current code takes all the values from the rest of the page starting from Number 3. and ending with the last time “dollars” occurs. Can someone please help me alter it so that it trims the rest instead?
Hi welcome to the community!
This seems too simple to use regex, i recommend just removing the part you dont need from the string if it is always the same part you need to remove like: result = "Number 3. Amount: 23 dollars".Remove(0, 17)
Hi! I did a simplified version of the string. The only thing that is unique is that i want to extract the value after “Number 3. Amount:” (size of it and values around it can vary).
This is why i want to use a trim for everything after, because if the end value is not unique it will take everything until the last time Dollars occurs.
If this is the string:
Number 1: Amount 22 dollars
Number 3: Amount 14 dollars
Number 8: Amount 43 dollars
I’ve tried both the alternatives now, but both times it just starts with the right value and then takes everything that comes after. Does anything look wrong with either of them?
I cannot share it, but the only difference between my example and the real one is that the string i have does not contain rows. Its structured this way:
Numer 6 Amount:44 dollars Number 3 Amount:0,45 dollars Number 8 Amount:9,5 dollars Number 4 Amount:88 dollars