The regular expression of Java programming

Source: Internet
Author: User

Regular expressions usually in the use of string processing time is more commonly used, the individual feel that do not need to deliberately to understand, with the words to take out the document to check the good, the following to a link

Http://www.php100.com/manual/Javascript/html/jsgrpRegExpSyntax.htm

This is a regular expression of the document, when you can go to check, the following with a small example of familiar with, the function is to input a string of strings, output the number of numbers, the code is relatively simple:

ImportJava.util.Scanner;ImportJava.util.regex.Matcher;ImportJava.util.regex.Pattern; Public classReg_test1 { Public Static voidMain (string[] args) {Reg_test1 rt=NewReg_test1 ();    Rt.function (); }         Public voidfunction () {intCount = 0; Pattern P= Pattern.compile ("(\\d+)"); Scanner s=NewScanner (system.in); Matcher m=P.matcher (S.nextline ());  while(M.find ()) {count++;    } System.out.println (count); }}

The regular expression of Java programming

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.