Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.regex.*;
- class RegTest1{
- public static void main(String[] args){
- String expression=args[0],
- source=args[1];
- Pattern p=Pattern.compile(expression);
- Matcher m=p.matcher(source);
- System.out.println("expression:" +m.pattern());
- System.out.println("source:" +expression);
- System.out.println(" index:012345678901234567890" );
- System.out.println(" 0 1 2\n" );
- System.out.println("match positions:");
- while(m.find())
- System.out.print(m.start()+" ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement