File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

scanner findInLine method

 
Ankit Gareta
Ranch Hand
Posts: 67
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,


I can't understand the output, actually i m confused on "s.findInLine("(\\d+) fish (\\d+) fish (\\w+) fish (\\w+)");" this line. what this line actually want to say ?

Thanks in advance.
Ankit
 
Nikhil Sagar
Ranch Hand
Posts: 216
Java Linux Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ankit Gareta wrote:Hi all,


I can't understand the output, actually i m confused on "s.findInLine("(\\d+) fish (\\d+) fish (\\w+) fish (\\w+)");" this line. what this line actually want to say ?

Thanks in advance.
Ankit


In your case findInLine() says that-
Find, "(\\d+) fish (\\d+) fish (\\w+) fish (\\w+)" in String s.
 
Ankit Gareta
Ranch Hand
Posts: 67
Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this "(\\d+) fish (\\d+) fish (\\w+) fish (\\w+)" String pattern doesn't return only one token where the Scanner string is "1 fish 2 fish red fish blue fish" ?
because first one or more digit then fish(2 times), then one or more words then fish...that will get in whole line.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic