tdsmithj — 2011-06-22T02:30:42-04:00 — #1
Hi, I am after a regular expression which checks for a specific whitespace in a string before a word in c#.
What I mean if I have a string called "Hi, I am a woman".
Problem is I want to check if a man the string is a man or woman.
So I need a regex which checks for whitespace before 'man'.
if (string == " man") = man else if (string == "man" = woman.
imaginekitty — 2011-06-22T17:45:49-04:00 — #2
White space in regex is \s so the regular expression to match "man" but not "woman" would be
tdsmithj — 2011-06-25T05:33:05-04:00 — #3
hi thabks for your help, but i got got the pattern wrong.
Problem is i was looking for a space before man but what if man starts at the beginning of a sentence? hence there is no space.
I have corrected this but instead of looking for a space, then i look for any characters before the word 'man'. so for example wo-man then then show up as a match. If it were to match then it would return false.
imaginekitty — 2011-06-25T08:33:22-04:00 — #4