private static bool DoesHydraulicBoundaryLocationMatchWithDuneLocation(HydraulicBoundaryLocation hydraulicBoundaryLocation, ReadDuneLocation readDuneLocation) { if (!Math2D.AreEqualPoints(hydraulicBoundaryLocation.Location, readDuneLocation.Location)) { return(false); } // Regex to search for a pattern like "<Some text without white spaces>_<integer>_<decimal>" // Only the last number is captured in a group called "Offset" // The last number can also contain decimals. var regex = new Regex(@"^(?:\S+)_(?:\d+)_(?<Offset>(?:\d+\.)?\d+$)"); Match match = regex.Match(hydraulicBoundaryLocation.Name); if (!match.Success) { log.ErrorFormat(Resources.DuneErosionDataSynchronizationService_SetDuneLocations_Location_0_is_dune_location_but_name_is_not_according_format, hydraulicBoundaryLocation.Name); return(false); } string duneLocationOffset = readDuneLocation.Offset.ToString(DuneErosionDataResources.DuneLocation_Offset_format, CultureInfo.InvariantCulture); return(match.Groups["Offset"].Value == duneLocationOffset); }