[Israel.pm] match & expression Q.

Gaal Yahas gaal at forum2.org
Sat Jul 17 23:27:40 PDT 2004


On Sun, Jul 18, 2004 at 09:19:09AM +0300, Ernst, Yehuda wrote:
> how do i write a line that will bring me 2 variables with the English and the numbers

You need a "character class" that contains English letters and numerals:

> שלום כיתה א ABC123 מה 12345 שלומכם היום 
> 
> the answer will be 
> $var1 = abc123
> $var2 = 12345

@vars = $string =~ /([0-9a-z])/gi;

"g" means match multiple times
"i" means case insensitive ("incasitive", to use Anatoly Vorobey's
    neologism); you could have used [0-9a-zA-Z] instead.

Your results will be in $vars[0], $vars[1], and so on.

-- 
Gaal Yahas <gaal at forum2.org>
http://gaal.livejournal.com/



More information about the Perl mailing list