Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pattern matching doubt

 
akila sekaran
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i used the following string to match files that have .cpp or c++ or cc extension. but it gives error. I think some problem is there is the syntax. But no idea what it would be.

 
Anayonkar Shivalkar
Bartender
Posts: 1557
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
akila sekaran wrote:but it gives error

Please, TellTheDetails. What is the error? (by 'error', do you mean compilation error? in that case, a single line of code won't help us to figure out the actual problem)

Also, during pattern matching, (at least I) follow the process of 'starting with small' - e.g. firstly, make the code working with '.' in the string, then make it working with .cpp, and then go for multiple extensions.

I hope this helps.
 
Winston Gutkowski
Bartender
Pie
Posts: 10527
64
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Akila, I really think you need to read the HowToAskQuestionsOnJavaRanch (←click) page.

Just providing a few lines of code and firing off vague questions like "I have a doubt about..." or "I think there's some problem, but..." gives the impression that you:
(a) Haven't bothered to read the tutorials (or the requisite material for your class).
(b) Haven't made an effort to at least try some solutions yourself.
(c) Want someone else to do your work for you.

Now all of the above may be false, but you need to learn to ask precise questions to avoid giving that impression.
My advice: After you've read our page, have a look at this one and this one. The first contains several excellent tips on how to formulate questions properly, particularly ones that involve programming code, and the second is a great general guide to asking question on sites like ours.

Remember: It's the policy of this site not to just "hand out answers".

Thanks.

Winston
 
Ashwin Soni
Greenhorn
Posts: 18
Android Flex Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
According to 1 line of code you have given it will give "illegal escape character" error at compile time. And this error occurs if you attempt to use backlash before a wrong character where it shouldn't be.
 
Campbell Ritchie
Sheriff
Pie
Posts: 50246
79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to replace the single \ with \\ before the dot.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic