From 79cae2c4cb52ff0d105292121ea9637886f1f8af Mon Sep 17 00:00:00 2001 From: "cmzmasek@gmail.com" Date: Tue, 14 Oct 2014 22:26:20 +0000 Subject: [PATCH] regex search --- .../src/org/forester/phylogeny/PhylogenyMethods.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/forester/java/src/org/forester/phylogeny/PhylogenyMethods.java b/forester/java/src/org/forester/phylogeny/PhylogenyMethods.java index f7aa56d..5bb29e1 100644 --- a/forester/java/src/org/forester/phylogeny/PhylogenyMethods.java +++ b/forester/java/src/org/forester/phylogeny/PhylogenyMethods.java @@ -1672,7 +1672,19 @@ public class PhylogenyMethods { return my_s.indexOf( my_query ) >= 0; } else { - return Pattern.compile( "(\\b|_)" + Pattern.quote( my_query ) + "(\\b|_)" ).matcher( my_s ).find(); + Pattern p = null; + try { + p = Pattern.compile( "(\\b|_)" + Pattern.quote( my_query ) + "(\\b|_)" ); + } + catch ( final PatternSyntaxException e ) { + return false; + } + if ( p != null ) { + return p.matcher( my_s ).find(); + } + else { + return false; + } } } -- 1.7.10.2