Computer Forum  

Go Back   Computer Forum > Computer Forums > Programming Forum > Perl Forum

Perl Forum Perl Forum. Perl Programming and coding forum. Post code, questions, answers and ideas here.


Perl search for same word appearing twice using { }?

Perl Forum

Perl Forum. Perl Programming and coding forum. Post code, questions, answers and ideas here.


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-24-2008, 04:22 PM
lda lda is offline
Junior Member
 
Join Date: Aug 2008
Posts: 1
lda RSS Feed
Perl search for same word appearing twice using { }?

I'm trying to identify lines in a text file that have the word "light" appearing at least twice.

For example, Gen 1:3 has:
And God said, "Let there be light; and there was light.

The PCRE newbie is stumped at how to specify that with the { } syntax. I can get it to work with:
light.+light
but I want to understand how to use {2,}

I've used boost::regex, and I think the following would have worked:
(light){2,}

but this doesn't seem to work (at least for me) with PCRE.

And actually, what I'm trying to accomplish is finding a line with either "light" or "evening" appearing twice ... but not either "light" or "evening" each appearing. An example is 2 Chron 13:11 with "evening" appearing twice.
Reply With Quote
  #2 (permalink)  
Old 08-24-2008, 04:23 PM
Junior Member
 
Join Date: Aug 2008
Posts: 3
dt192 RSS Feed
i used to use PERL in the olden days but now i use PHP like everyone else, i had a look around for an answer to this but couldnt find one sorry
Reply With Quote
  #3 (permalink)  
Old 08-24-2008, 04:38 PM
Member
 
Join Date: May 2008
Posts: 42
martinthurn RSS Feed
You can not do that with the {} construct. The {} construct is used to specify multiple CONTIGUOUS occurrences of an expression. There can't be any extra stuff in between the occurrences.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to write a perl script to search text files for a specific string and Travis C Perl Forum 1 06-04-2008 02:46 AM
how to search a word from paragraph in c language (need simple coding using strcmp... shock C# Programming Forum 0 04-25-2008 11:13 AM
Every time i google search I get another "search engine called "Search paul k Google Forum 0 01-11-2008 02:10 PM
my friend opened a website but nobody is able to search it on google or yahoo search? sassy_girl Google Forum 0 01-11-2008 07:22 AM
Why are blue spots appearing on my lcd projection tv? Matty Rear Projection TV Forum 2 01-04-2008 10:08 AM


All times are GMT. The time now is 04:41 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93