Hi,
Thnx for your solution, although I did not get the complete solution as
explained in your earlier email.
Can you please simplify your explanation. Also, would it not be possible
w/o making wordlist.unified.
Thanks.
Dr.Ruud wrote:
Gunwant Singh:
I have a query regarding regexes.
No, you don't.
I am to match only one specific word in a wordlist which has only
those alphabets which it contains and none other than that.
To do that, you can use regexes, but you don't need to.
My Wordlist contains:
alpha
alpha1
beta
betaze
gamma
gamman
gammano
I want to match any scrambled word with a word in the wordlist which
has exactly the same alphabets may be unscrambled/scrambled no other
alphabets. Say, If I enter 'ammag' (scrambled word for gamma), it
should only match 'gamma' and NOT 'gamman' | 'gammano'
Then the first thing you will check is the length. You don't need a
regex to do that, though you can use a regex, but normally you would use
the builtin function length(). (see `perldoc -f length`)
After this you need to compare the character frequencies.
An easy way to do that is to transform your word to a scrambled version
where the characters are sorted internally (gamma -> aagmm).
You can do that once with your Wordlist (and store that as
Wordlist.unified).
perl -wle '
$word = "Gamma";
$sorted = join "", sort split "", lc($word);
print $sorted;
'
aagmm
--
Gunwant Singh.
"What is the sound of Perl?
Is it not the sound of Wall that people bang their heads against?"
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/