Advertisement
marcelopaixaoresende

Untitled

Jan 23rd, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.90 KB | None | 0 0
  1.  
  2. import java.util.regex.Matcher;
  3. import java.util.regex.Pattern;
  4.  
  5. public class RegexTest {
  6.     public static void main(String[] args) {
  7.         String query = "select c.concept,       a.name as applicationName,       a.application_type_id as typefrom application_organization ao    inner join application a on a.id = ao.application_id    inner join category c on c.id = ao.category_idwhere ao.organization_id = :organization_id      and ao.last_collected_date >= CAST( :initial_date as date )       {{#category_id}} and ao.category_id <> :category_id {{/category_id}}      {{#applications}} and a.name in :applications {{/applications}}";
  8.         Pattern compiled = java.util.regex.Pattern.compile("\\{\\{#([A-Za-z_]+)\\}\\}", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE);
  9.         Matcher matcher = compiled.matcher(query);
  10.        
  11.         while (matcher.find()) {
  12.             String group = matcher.group(1);
  13.             System.out.println(group);
  14.         }
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement