Resetting a Matcher in Regular Expression
From Java Example Source Code
Contents |
[edit] Overview - Resetting a Matcher in Regular Expression
This example shows you how to reset a matcher of regular expression .
[edit] Java Source Code
- Package: com.bruceeckel
- File: Resetting.java
package com.bruceeckel; //: c12:Resetting.java //From 'Thinking in Java, 3rd ed.' (c) Bruce Eckel 2002 //www.BruceEckel.com. See copyright notice in CopyRight.txt. import java.util.regex.Matcher; import java.util.regex.Pattern; public class Resetting { public static void main(String[] args) throws Exception { Matcher m = Pattern.compile("[frb][aiu][gx]").matcher("fix the rug with bags"); while (m.find()) System.out.println(m.group()); m.reset("fix the rig with rags"); while (m.find()) System.out.println(m.group()); } }
[edit] What Result You Can Get
Run the program, you will get:
fix rug bag fix rig rag
[edit] Required External Library for this Java Example
Need nothing.
http://www.ase2009.com/ online casino 132 http://www.hellzyea.com/health health insurance 8DDD http://www.yourautoinsurancesite.com/ auto insurance quotes 135811 http://www.makemeasammich.com/ auto insurance mcnxu
[edit] Question & Answer
Any question?
Click edit and post your question or answer here.
