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.
any ideas?
White space in regex is \s so the regular expression to match “man” but not “woman” would be
\\sman
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.
Any help?