Regular expression to match a word or its prefix
Square brackets are meant for character class, and you’re actually trying to match any one of: s, |, s (again), e, a, s (again), o and n. Use parentheses instead for grouping: or non-capturing group: Note: Non-capture groups tell the engine that it doesn’t need to store the match, while the other one (capturing group does). For small stuff, either works, for ‘heavy duty’ stuff, you … Read more