Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Special Variables and Multiple Regexp Matching

by LanX (Chancellor)
on Nov 18, 2013 at 00:30 UTC ( #1063023=note: print w/replies, xml ) Need Help??


in reply to Special Variables and Multiple Regexp Matching

I'm not sure what your goal is...

We have to guess how '$token' and '$line' look like, and I have no idea why the (undemonstrated) while loop should not terminate.

(see How (Not) To Ask A Question and How do I post a question effectively?)

But pos will tell you where the last match paused, the rest should be easily calculated with 'length($token)' (IF token is just a simple string)

DB<127> $str= "a b " x 4 => "a b a b a b a b " DB<128> $token="a" => "a" DB<129> print pos($str),": $1\n" while $str =~ /($token)/g 1: a 7: a 13: a 19: a

update

) well except the fact that lc always creates a new string which resets the search-position. Simply lowercase once '$line' before you loop!

Cheers Rolf

( addicted to the Perl Programming Language)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1063023]
help
Chatterbox?
[Mr. Muskrat]: Is it just me or does that timeout issue seems to be happening more often lately?
[Corion]: Mr. Muskrat: I'm not sure if it really happens more often, but I don't exactly know either
[LanX]: yep
[LanX]: more often for some weeks now
[Corion]: I think I'll have to manually (as god) intervene with that node, as the simple reparenting didn't seem to fix the parent/child relationship of the nodes
[Corion]: I think I have an idea but I'll have to open a ticket with Pair.com on that - hopefully I get to that on the weekend
LanX imagines a burning thorn bush
[Mr. Muskrat]: Thank you!
[Mr. Muskrat]: Oh that is odd. I got the message that it was reparented but yeah, it didn't actually do it. lol
[Corion]: LanX: No, Co-Rion appears as Monkey God :-)

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (11)
As of 2017-01-19 16:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you watch meteor showers?




    Results (170 votes). Check out past polls.