regex's Profile
Reputation: -4
Dishonored
- Group:
- Members
- Active Posts:
- 33 (0.14 per day)
- Joined:
- 25-September 12
- Profile Views:
- 799
- Last Active:
Apr 03 2013 08:33 AM- Currently:
- Offline
Previous Fields
- Country:
- Who Cares
- OS Preference:
- Who Cares
- Favorite Browser:
- Who Cares
- Favorite Processor:
- Who Cares
- Favorite Gaming Platform:
- Who Cares
- Your Car:
- Who Cares
- Dream Kudos:
- 0
Posts I've Made
-
In Topic: Regex Pattern
Posted 1 Apr 2013
The numbers occur at the start of the string.
I am using the Csharp based string.replace() method. I only want the LETTERS within the first word REMAINING. So that I am left with either an F or M or any derivative therein for the gender.
That means REMOVING any number, second word, and white space.
Original: 23F Type
Match: 23 Type
Result after REPLACE Should be: F -
In Topic: Regex Pattern
Posted 1 Apr 2013
Need to match:
String: 23F Type
Match: Everything EXCEPT any character that comes after the first numbers.
I am using C#. I am trying to get Gender from this string. I need to only match numbers within the first word in this string, white spaces, and the second word. ONLY allow non-numeric charecters within the first word.
input = Regex.Replace(instance.Text, @"\b(\w*)\b$", String.Empty, RegexOptions.IgnoreCase);
-
In Topic: Regex Pattern
Posted 29 Mar 2013
I want the word that comes both before and after actually. I took a look at the problem again. Yes, follows the space!
Stored in an array, IList, or whatever. -
In Topic: Unit Testing MSpec and Rhino
Posted 1 Mar 2013
-
In Topic: Unit Testing MSpec and Rhino
Posted 28 Feb 2013
How about this. I just want to test GetCurrentConditions.
public class WeatherService : IWeatherService { readonly IWeatherRepository _weatherRepository; readonly ISiteSettingsService _siteSettingsService; readonly ICurrentSiteModel _current; readonly ICacheProvider<CurrentConditionsDTO> _currentConditionsCacheProvider; readonly ICacheProvider<DailyForecastDTO> _dailyForecastCacheProvider; readonly ICacheProvider<HourlyForecastDTO> _hourlyForecastCacheProvider; readonly int _siteId; readonly SiteSettingsDTO _siteSettings; public WeatherService(IWeatherRepository weatherRepository, ISiteSettingsService siteSettingsService, ICurrentSiteModel current, ICacheProvider<CurrentConditionsDTO> currentConditionsCacheProvider, ICacheProvider<DailyForecastDTO> dailyForecastCacheProvider, ICacheProvider<HourlyForecastDTO> hourlyForecastCacheProvider) { _weatherRepository = weatherRepository; _siteSettingsService = siteSettingsService; _currentConditionsCacheProvider = currentConditionsCacheProvider; _dailyForecastCacheProvider = dailyForecastCacheProvider; _hourlyForecastCacheProvider = hourlyForecastCacheProvider; _current = current; _siteId = _current.Site.OldSiteId; _siteSettings = _siteSettingsService.LoadSiteSettings(); } private static readonly Regex caZipRegex = new Regex(@"^([AaBbCcEeGgHhJjKkLlMmNnPpRrSsTtVvXxYy]\d[A-Za-z]\s?\d[A-Za-z]\d)$", RegexOptions.Compiled); private static readonly Regex usaZipRegex = new Regex(@"(\d{5}|\d{5}\-\d{4})$", RegexOptions.Compiled); private static readonly Regex cityStateRegex = new Regex(@"^(?<city>[\.A-Za-z\s]*)(?:,\s?(?<state>[\sA-Za-z]+)|\s(?<state>[A-Za-z]{2}))", RegexOptions.Compiled); #region Current Conditions public CurrentConditionsViewModel GetCurrentConditions(bool canUseAPI) { int groupID; Int32.TryParse(_siteSettings.SiteSettingsDictionary.GetValueSafe(string.Format("{0}-{1}", SiteSettingsCategory.Weather.ToString(), "WeatherGroupID")), out groupID); return GetCurrentConditions(GetGroupLocation(groupID, null), canUseAPI); }
Test:
public class GetCurrentConditions : WeatherServiceSpecs { public static CurrentConditionsViewModel _currentConditionsViewModel; public static bool canUseAPI; Establish that = () => { _currentConditionsViewModel = new CurrentConditionsViewModel { ConditionID = 1 }; }; Because of = () => _currentConditionsViewModel = Subject.GetCurrentConditions(canUseAPI); It Can_Use_API_To_Access = () => _currentConditionsViewModel.ShouldBeOfType<CurrentConditionsViewModel>();
I get Unable to create an instance of type WeatheService. The constructor threw an exception. I'm using Ninject. I still have to pass in all the fields into the constructor?
My Information
- Member Title:
- New D.I.C Head
- Age:
- Age Unknown
- Birthday:
- Birthday Unknown
- Gender:
-
Contact Information
- E-mail:
- Private
- LinkedIn:
- http://www.linkedin.com/pub/brock-fredin/11/609/879
Friends
regex hasn't added any friends yet.
|
|


Find Topics
Find Posts
View Reputation Given

|
Comments
regex has no profile comments yet. Why not say hello?