Sponsered Links
Categories
Sponsered Links

Core Java Regular Expression Example

 

This is a simple Core Java Regular Expression Example.

import java.util.regex.*;
import java.util.*;

      public static final String NUMBER_REGEX = "[0-9]+";

      public static List findNumbersIn(String s) {
          List ret;
          Pattern p;
          Matcher m;
          String num;

          ret = new ArrayList();  // starts empty
          p = Pattern.compile(NUMBER_REGEX);
          m = p.matcher(s);
          while(m.find()) {
              num = m.group();
              ret.add(num);
          }
          return ret;
      }

 
 
Sponsered Links
Latest Updates
 
All Content of this site is for learning only. We do not warrant the correctness of its content. The risk from using it lies entirely with the user. While using this site, you agree to have read and accepted our terms of use and privacy policy.
Copyright © 2009 JSPSERVLETTUTORIAL.INFO All Right Reserved