• Post Reply Bookmark Topic Watch Topic
  • New Topic

finding a word in a string?

 
bairava surya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

i need to find the frequency of hackerrank in a sentence so this program doesnt provide exact output so please help me with the logic?
 
Campbell Ritchie
Marshal
Posts: 52555
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, start by telling us what went wrong. What did you expect, and what happened?
Also explain what your regex is doing.
 
bairava surya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i need to know the occurrence of hackerrank in the string so help me to write the logic for the pattern ?
 
Henry Wong
author
Sheriff
Posts: 22526
109
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bairava surya wrote:i need to know the occurrence of hackerrank in the string so help me to write the logic for the pattern ?


Let me guess, if that word appears more than once in the string, it is only matched once? If so, here is a hint...

Hint: You are using greedy qualifiers.

Henry
 
bairava surya
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my program works single freuency but not works when it apears more than once?
 
Campbell Ritchie
Marshal
Posts: 52555
119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to work out what your regex is doing.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!