• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

confusion with the Matcher Class Programs..

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
import java.util.regex.*;
class Regex2
{
public static void main(String[] args)
{
Pattern p = Pattern.compile(args[0]); // "\d*"
Matcher m = p.matcher(args[1]); //ab34ef
boolean b = false;
while(b = m.find())
{
System.out.print(m.start() + m.group());
}
}
}
Run this above prgam with java Regex2 "\d*" ab34ef
Can any one explain this above program please...Preparing for SCJP 5.0..
Thanks in advance..
Ishmayel.
[ November 27, 2007: Message edited by: ishmayel vemuru ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You didn't say what you're confused about, but this particular example is asked about so often that it has its own FAQ entry.
 
reply
    Bookmark Topic Watch Topic
  • New Topic