How can I set a regex pattern which matches all words but the strings which starts with
- /word
- /word/
- /word/ following by anything else.
I think the pattern starts with \A but I don'0t know how to tell that should not follow a word
Thanks
Take a look at the lookaround feature offered by regular expressions. Also, a similar thread. Also, posting your question in terms of a concrete sample problem might help you get a few working sample snippets.
Perhaps using a string comparison will be clearer and faster.
if (text.startsWith("word")) {
// text is OK
} else {
// not OK
}