preg_match occurence position. Programming Web Development by isomillennium is there a way to tell the occurence postition of the regex given ?? for example .. $text = 'PHP Hypertext … (preg_match('xt', $text)){ echo 'Found Match'; } Like in that example occurence position is 11.. I already know about the strpos() .. but… sequential search occurence Programming Software Development by Hey11 hello i wanted to ask how to create a function that makes the insertion code search for an occurence that i will insert with a cin , instead of picking the first occurence for example the array is arr[]={1,2,3,5,3,1,3} there are 3 threes here , i want to get the index for the one i want using a cin , plz help me Re: preg_match occurence position. Programming Web Development by isomillennium Cool . Thanx .. I actuially realized i didnt even need the occurence postion to do that .. this is what i did from … Re: sequential search occurence Programming Software Development by Hey11 now i modified it but it still views the first occurence [CODE]#include<iostream> using namespace std; int last(… Re: How to count max occurence of rating Programming Web Development by Sophia_1 … Max(Rating1),Max(Rating2), where Max(Rating1) is the maximum occurence from many Kra(Key result area) for Quarter 1 and… Max(Rating2) is the maximum occurence from many Kra(Key result area) for Quarter 2. These… Re: How to count max occurence of rating Programming Web Development by Sophia_1 … The Max(Rating1) is the max occurence for Rating1 and Max(Rating2) is the max occurence for Rating2. In addition would also… Copy all node till occurence of next li in xslt 1.0 Programming Software Development by timar …> Basically it should copy all nodes and attributes till occurence of next <li> . Same process should be repeated… Count occurence of each characters in a string Programming Software Development by jazz_vill Hi I want to count the number of occurence of each characters in a string from a client then … find occurence of digits in a string Programming Software Development by akonful I am developing a code to find the occurence of digits in a string. I need help. When it compiles I get the error: cannot find symbol variable countDigits Replace last occurence of a substring from a string Programming Web Development by kalleanka …! I am looking for a function that will replace last occurence of a substring from a string: tmpStr: xxx, yyy, zzz… How to count max occurence of rating Programming Web Development by Sophia_1 …),Max(Rating2),Tot_Rating`...the task is to display the max occurence of rating.There are 2 types of rating ie "… Pattern returns only first occurence Programming Software Development by nikk8a … in the pattern that I am getting only the first occurence? Thanks! Re: Pattern returns only first occurence Programming Software Development by sepp2k You're only getting one occurence because you're only calling find once. If you use a while-loop instead of an if, you'll call it until it returns false, which will give you all the matches. Re: Program to read a line and count occurence of each letter and punctuation Programming Software Development by Demonoid2008 … finally figured it out here's the code: it counts occurence of each letter, doesn't matter if it's upper… are processed jne START L5: ;Displaying the final number of occurence of each value call Crlf mWrite<"A's… occurence of a word in a text. Programming Software Development by newtechie i was trying to write a code for counting the number of ocurence of a particular word from a sentence.it gives me a wrong output it starts checking for the same alphabets in the sentence rather than the word. [CODE]import java.lang.String; public class StringCount2 { public static void main(String args[]) { String … Re: occurence of a word in a text. Programming Software Development by Alex Edwards If you need to search for a particular word, use the Regex API -- [url]http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html[/url] -- though, be warned. It is not fond of the light-hearted occurrence-searcher. Re: occurence of a word in a text. Programming Software Development by tyagi Condition on incrementing the result must do the trick. Count should increment only if the word you are searching for in the String(Sentence) does not have any letters of Alphabet before or after it. Try out this.. [code=Java] public class StringCount2 { public static void main(String args[]) { String searchFor = "… Re: occurence of a word in a text. Programming Software Development by newtechie thanks tyagi it works. Re: occurence of a word in a text. Programming Software Development by newtechie hi thyagi, i could not understand the if part [QUOTE]if(((a>=65 && a<=90) || (a>=97 && a<=122)) || ((b>=65 && b<=90) || (b>=97 && b>=122))) [/QUOTE] how you got those values for and b pl. clarify Re: occurence of a word in a text. Programming Software Development by tuse Look at an ASCII value table. You will get your answer. Re: occurence of a word in a text. Programming Software Development by tyagi Yes.The if part is to check whether the ASCII equivalent of the character adjacent the required word in the string on either sides is a letter of the Alphabet or not. Note that it is 'OR' so as to account for non increment in cases like 'this' in the example you have mentioned, which implies that the ASCII equivalent of the character adjacent the … Re: preg_match occurence position. Programming Web Development by nav33n [code=php] <?php $subject = "PHP Hypertext Preprocessor"; $pattern = '/xt/'; preg_match($pattern, $subject, $matches, PREG_OFFSET_CAPTURE); print "<pre>"; print_r($matches); print "</pre>"; ?> [/code] $matches[1] returns 11. [url]http://in2.php.net/manual/en/function.preg-match.php[/url] It works but… Re: preg_match occurence position. Programming Web Development by nav33n Great! :) Re: sequential search occurence Programming Software Development by Fbody So do you want to put in, for example, "3 2" and have it find the second occurrence of the value "3"? Re: sequential search occurence Programming Software Development by Hey11 yeah Re: sequential search occurence Programming Software Development by myk45 @OP How about this: [CODE]cin >> num; cin >> occuranceValue; for (int index = 0, count = 0; count < occuranceValue; index++) { if (arr[index] == num) count++; } return index; // shows the index in the array where the nth occurance of num is present. [/CODE] Re: sequential search occurence Programming Software Development by Hey11 it is gives me always a zero [CODE]#include<iostream> using namespace std; int last(int arr[] , int ssize , int key ,int val) { int i ; for ( i=0 ; i<=ssize ;i++ ) { for (int count =0 ;count<val ;count ++) {if (arr[i] == key) count++; } return i ; } return -1 ; } int main() { int arr[]={1,2,… Re: sequential search occurence Programming Software Development by WaltP [QUOTE=Hey11] plz help , whats wrong in the code ??[/QUOTE] Here's what I see wrong: 1) Bad formatting, making the code hard to follow ([url=http://www.gidnetwork.com/b-38.html]see this[/url]) 2) Using [ICODE]system("pause");[/ICODE] ([url=http://www.gidnetwork.com/b-43.html]see this[/url]) 3) Incrementing the FOR loop counter … Re: sequential search occurence Programming Software Development by Hey11 using the system pause is necessary for me because i use the dev c++ and where shall i increment the for loop counter ?? Re: sequential search occurence Programming Software Development by WaltP You obviously didn't bother to read the links I posted. I tried to help....