title: How to process a list of patterns using Pattern.compile in java
body: <p>The code shown here is processing single pattern value. But now i need to process a list of patterns. Can anyone suggest an alternative for Pattern.compile(pattern). Since it processes only a single value. Here patternValue is an arraylist populating from database.</p>
  
  <pre><code>public static String processFuction(String input, String pattern, String replace)
              throws Exception {
          try {
              Pattern p = Pattern.compile(pattern);
              Matcher m = p.matcher(input);
              input = m.replaceAll(replace);
          } catch (Exception ex) {
              logger.severe(ex.getMessage());
          }
          return input;
      } 
  
  text = processFuction(text, patternValue,name[0]);
  </code></pre>