Technology, Web & Business Forum

You are here: Technology, Web & Business Forum : Web Development : Programming : Perl search for same word appearing twice using { }?


Welcome to the Technology, Web & Business Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.


Programming Discuss programming languages such as .NET, PHP, PERL, ASP, ColdFusion, C++


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-28-2008
lda lda is offline
Junior Member
 
Join Date: Apr 2008
Posts: 1
Default 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.
__________________
Powered by Yahoo! Answers
Reply With Quote
  #2 (permalink)  
Old 04-28-2008
Junior Member
 
Join Date: Apr 2008
Posts: 2
Default

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
__________________
Powered by Yahoo! Answers
Reply With Quote
  #3 (permalink)  
Old 04-29-2008
Junior Member
 
Join Date: Apr 2008
Posts: 2
Default

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.
__________________
Powered by Yahoo! Answers
Reply With Quote
Reply

Thread Tools
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


All times are GMT -5. The time now is 07:38 PM.