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

Re^2: RegEx + vs. {1,}

by choroba (Canon)
on Oct 10, 2012 at 14:25 UTC ( #998233=note: print w/ replies, xml ) Need Help??

in reply to Re: RegEx + vs. {1,}
in thread RegEx + vs. {1,}

Or, just remove the comma from the quantifier: \w{2}

لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Comment on Re^2: RegEx + vs. {1,}
Download Code
Replies are listed 'Best First'.
Re^3: RegEx + vs. {1,}
by tobyink (Abbot) on Oct 10, 2012 at 22:08 UTC

    Indeed. There can never be a three character sequence in your string which occurs more frequently than a two character sequence. (Because the three character sequence contains two two character sequences.)

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
      But what should be returned if we have string 'abcabcabcdef' with same amount of three-chars-long and two-chars-long string? 'ab' or 'abc'? I assume OP wants the longer one.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://998233]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2015-10-04 08:43 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (100 votes), past polls