I have some regex patterns as shown below. My idea is to make these lines as default patterns, but others can override these with some changed pattern in some external file, in the classpath for example.
If my code finds such a file, it will use the content in the file instead of these default patterns, meaning we don't need to edit the code if the pattern is improved or changed.
But I need to also consider performance. Would this reduce performance?
What's your advice about this idea. Doable, not-doable or not necessary?
private final String ALPHA_CHAR = "[a-zA-Z]+";
private final String ALPHANUMERIC_CHAR = "[a-zA-Z0-9\\_]+";
private final String ADDITIONAL_CHAR = "[a-zA-Z0-9\\_\\-\\,\\.\\s\\!\\#\\$\\&\\(\\)\\*\\+\\;\\:\\=\\?\\@\\|\\[\\]\\{\\}\\~]+";
Aucun commentaire:
Enregistrer un commentaire