Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
if ($word =~ /[$random_string]$/i)

That only checks the last character from $word.

I don't think regexes are a good tool for the job. Instead keep a hash of how often each character may appear in the string. Iterate through all characters of the string, and for each character check if it's still allowed. If no, give out an error message. If yes, decrease the allowed count for that character.


In reply to Re: Regex to compare (if) two strings (Uniquely - I will explain inside) by moritz
in thread Regex to compare (if) two strings (Uniquely - I will explain inside) by chickenlips

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    Lady_Aleena clean up after dinner finally.
    [Discipulus]: uch! so we are twice lucky to have MCE..;=)
    [marioroy]: Working a midnight graveyard shift, on the way home ran out of gas. just 2 minutes later somebody stops with a small tank of gas. It's wierd. There's always someone nearby for some reason.
    [Lady_Aleena]: I was the one who stop[ed in the middle of a cold night to pick up a small family walking to a gas station. I got a few gallons of free gas for the round trip, and the grandmother said she'd pray for me.
    [marioroy]: Folks do not know it, but MCE was ridiculously difficult. At Niagra Falls, heard a voice on enabling Grace while in the mist boat. That 10x performance is possible.
    [marioroy]: Lady_Aleena Angels on earth are real people. That's awesome.
    [Lady_Aleena]: marioroy, what does MCE stand for in this instance? There are 3 pages of abbreviations to go through.
    [Lady_Aleena]: ^ or Discipulus...
    [marioroy]: Many-core Engine
    [choroba]: MCE

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (12)
    As of 2017-05-29 08:26 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?