Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Re: repeated characters in regular expressions

by Utilitarian (Vicar)
on Aug 01, 2013 at 07:54 UTC ( #1047383=note: print w/replies, xml ) Need Help??

in reply to repeated characters in regular expressions

Something like the following $string=~s/(.){$n}/$1 x $m /eg;

print "Good ",qw(night morning afternoon evening)[(localtime)[2]/6]," fellow monks."

Replies are listed 'Best First'.
Re^2: repeated characters in regular expressions
by Loops (Curate) on Aug 01, 2013 at 08:03 UTC
    The (.){$n} construct will match any sequence of $n characters, not just repeating characters.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1047383]
Discipulus go to his cell to bookmark this
[haukex]: Well to be honest I just did a super search for "every should know floating" ;-)
[Discipulus]: floating was the keyword and.. to use supersearch is plus sign not a (plus) sin

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (8)
As of 2017-06-26 20:59 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (594 votes). Check out past polls.