Greetings...

If the field length is set as you specified in the examples, then a substr
would probably be the fastest method.

        $my_data = 'CDM210909';
        $word = substr($my_data, 0, 3);
        $number = substr($my_data, 3);

If you absolutely must have a regex, it should be something like:
        $mydata =~ m/(\D{3})(\d+)/;
        $word = $1;
        $number = $2;

Have fun!

Jeremy Elston
Sr. Staff Unix System Administrator
Electronic Brokerage Technology
Charles Schwab & Co., Inc.
(602.431.2087 [EMAIL PROTECTED])

"Life is the final exam where no one can cheat, because we all have
different problems to solve."

WARNING:  All email sent to this address will be received by the Charles
Schwab Corporate email system and is subject to archival and review by
someone other than the recipient


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, March 01, 2001 1:14 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED];
[EMAIL PROTECTED];
[EMAIL PROTECTED];
[EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: [Perl-unix-users] REGULAR EXPRESSION IN SPLIT FUNCTION - PLEASE
HELP ME.


DEAR FRIENDS,
     PLEASE HELP ME REGARDING THE REGULAR EXPRESSION IN SPLIT FUNCTION

data is : CDM210909 or   FDM210909  ( ie start with 3characters followed
any no of numeric numbers)
probelm is : i need to split this word into CDM  and 210909    ( split into
characters & numbers).

--- ie, i wish to split this word into char (first 3 characters & remaining
)

@res=split( / .{3}/ , $data );

but i could'nt get the answer. can u please help me.
Expecting your ineffable Wishes,

Pons.
Extn:  1328
----------------------------------------------------------------------------
----

Learn to Grow  ------>   Grow to Learn more  & more.
----------------------------------------------------------------------------
----

_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users
_______________________________________________
Perl-Unix-Users mailing list. To unsubscribe go to 
http://listserv.ActiveState.com/mailman/subscribe/perl-unix-users

Reply via email to