Groovy web console

subscribe to the feed Subscribe
to this
site

Check2

Published 6 days ago by Chintan with tags PatternMatcher
Actions Execute script  ▶ Edit in console Back to console Show/hide line numbers View recent scripts
import java.util.regex.Pattern;
import java.util.regex.Matcher;

commandData.eachLine {
  if (it.contains(searchStr)) 
  {
   Pattern p = Pattern.compile("\\b$searchStr\\b");
   Matcher match = p.matcher(it);
   if(match) 
   {
    processId = it.find(/(spectrum)\s*\d{1,9}\s/).replace("spectrum","").trim();
   }
  }
	}