Hi,
I am trying to use regular expressions to determine what format the user have applied when entering input in a textbox.
The regular expressions are as follows:
(\\s?[" + alphabet + "]{9,9})+
To determine whether the input is one or more strings of length 9 in a given alphabet, possibly separated by whitespace.
(>[\\w\\s]+\\n[" + alphabet + "\\s]+)+
To check if the input is in FASTA format
The regular expressions run terribly slow when matching with inputString.matches(regexString)
. Why is this?
I figured this may be due to Java storing all potential matches (which I don't need at this point), but adding ?:
in every parenthesis breaks the regex. How should this be done?
Thank you,
Martin
Edit 1: I was unable to reproduce this issue - it only happens on one computer. This could suggest something wrong with that particular VM setup.
We need something more robust, and so we will be implementing this differently. I have picked Joel's answer as the right one, since I believe that some special case in Pattern may be the cause.