This content has been marked as final. Show 7 replies
Escape special characters.
You will need 2 escapes, one for the compiler and one for the regex engine. Also note the full stop and star are also special characters. So depneding upon what you are trying to do you may need to escape them also.
But note that if the regex is Java string literal--that is, in your source code in double quotes, as opposed to being read from user input or a config file, you'll need to double the backslash.
Also, note that that regex will match
as one group. The
will match the
Well, See I am making a response bot for a game called Runescape, the brain is made in java and it works like AIML, but I have a XML tag and a response to one of the triggers (a regex pattern could be )
How could I parse that to where it takes
(its|it's|it is) Attack, (you?|u?|you|u)
and chooses a random one?
I need a snippet that can process this:
and simplyify it to
(its|it's|it is) ATTACK, (you?|u?|you|u)
it is ATTACK, u?