Within a foreach loop I am capturing a piece of text of the element if it is displayed. However I only want to grab the number within the element text (both positive and negative).
Currently the text can read either:
+156 on same day
or
-88 on same day
I want to only grab the values from this text so this should either be:
156
or
-88
How can I grab only the numbers and if minus number the negative symbol from the alternativeAirportPrice.Text?
public string GetAlternativeAirportPrice(By airportPriceLocator)
{
    var alternativeAirportPrices = _driver.FindElements(airportPriceLocator);
    foreach (var alternativeAirportPrice in alternativeAirportPrices)
    {
        if (alternativeAirportPrice.Displayed)
            return alternativeAirportPrice.Text;
    }
    return null;
}
 
     
     
    