ariejan (owner)

Revisions

gist: 44052 Download_button fork
public
Public Clone URL: git://gist.github.com/44052.git
Embed All Files: show embed
1.java #
1
2
3
4
5
6
7
8
9
10
11
12
import java.util.regex.*;
 
class Regex2 {
  public static void main(String[] args) {
    Pattern p = Pattern.compile(args[0]);
    Matcher m = p.matcher(args[1]);
    boolean b = false;
    while(b = m.find()) {
      System.out.print(m.start() + m.group());
    }
  }
}
1.textile #

And the command line:

java Regex2 "\d*" ab34ef

What is the result?

  • A. 234
  • B. 334
  • C. 2334
  • D. 0123456
  • E. 01234456
  • F. 12334567
  • G. Compilation fails.