• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

how to find a particular word that match from the pattern matching in Java

 
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all,

I have a pattern matching code. the code is working fine. I want to find the particular key word that matched with the sentence. for example in this i want to display the word "Tim" alone stating that the key word that match is Tim. How to display that

the code is

how to make such output display?
 
Ranch Hand
Posts: 375
1
Python Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just match it with "Tim". It will give you the result. You don't need that long regex for that..

You can see ResourcesOnRegularExpressions for help.
 
deepika deepi
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

R. Jain wrote:Just match it with "Tim". It will give you the result. You don't need that long regex for that..

You can see ResourcesOnRegularExpressions for help.



ya i know that. but if the sentence is like this



i have Jackey, Tim, tim. i want to know that out of four regular expression. three are used as key words. so i want to display that. Hope i am clear! thank's for the tutorial.
 
R. Jain
Ranch Hand
Posts: 375
1
Python Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

deepika deepi wrote:

R. Jain wrote:Just match it with "Tim". It will give you the result. You don't need that long regex for that..

You can see ResourcesOnRegularExpressions for help.



ya i know that. but if the sentence is like this



i have Jackey, Tim, tim. i want to know that out of four regular expression. three are used as key words. so i want to display that. Hope i am clear! thank's for the tutorial.



Yeah you are almost clear..
But you can take a look in tutorials.. They will help. and you will know a lot more things about Regex
 
deepika deepi
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ya.. thank you Jain .. I got it. i just didn't tried out the last step what was necessary
 
R. Jain
Ranch Hand
Posts: 375
1
Python Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

deepika deepi wrote:ya.. thank you Jain .. I got it. i just didn't tried out the last step what was necessary



Good..
And would you please post that last step you took, here.. It may help other viewers in future..
 
deepika deepi
Ranch Hand
Posts: 199
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ya sure ..


 
keep an eye out for scorpions and black widows. But the tiny ads are safe.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic