what is the regular expression for male and female string

java, regex

Solution

You need to use `replaceAll` to use a regex, and the expression could be even simpler:

url.replaceAll("(Fem|M)ale","foo");

or

url.replaceAll("Female|Male","foo");

Problem

I have a url like ``` /.../Male/... or /../Female/... ``` Now i want to do something like follows to replace the string's male female part with foo ``` /../foo/.. ``` What is the regular expression for this... currently i am doing like below but no success ``` url.replace("(fe)?male","foo") ```

Original source