Gossamer Forum
Home : Products : DBMan : Customization :

Need help/ideas on parsing the userid.

Quote Reply
Need help/ideas on parsing the userid.
Perl has many ways to perform "surgery" Smile. What would the most efficient code be to extract "author" from this string...
$a = "author.234098333abc"
I need code for...
$userID = ???? what??? (to make $userID = "author".
I know there are a lot of different ways to do this. But, coming from an old-time basic programmer point of view I have a tendancy to thinking along "Basic" code. I have found that perl can handle things much more efficiently and would like some ideas.
Thanks
TimRyan



[This message has been edited by timryan (edited August 26, 1999).]
Quote Reply
Re: Need help/ideas on parsing the userid. In reply to
The way DBMan does it is

Code:
($db_userid) = $db_uid =~ /([A-Za-z0-9]+)\.\d+/;

Where $db_uid would be "author.234098333abc" and $db_userid would be "author."

Hmmmmm. I just realized you have letters in addition to numbers after the "dot". I guess that won't work. Unless you just stick to numbers.



------------------
JPD





Quote Reply
Re: Need help/ideas on parsing the userid. In reply to
Thanks JPD, that worked for what I needed. Actually your comments above allowed me to find the variables I needed to pass the UserID around on my Templates.
The example I gave was "off the cuff". I use the variable as DBMan sends it.

Thanks. Smile
TimRyan

[This message has been edited by timryan (edited August 26, 1999).]