Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: i wann get some character from a string

by GhodMode (Pilgrim)
on Aug 02, 2006 at 03:44 UTC ( [id://565141]=note: print w/replies, xml ) Need Help??


in reply to i wann get some character from a string

If you really want to use a regular expression for this, it would be something like /^.*?=(.*)$/. After that regex, $1 would hold your ID.

A regular expression isn't the right tool for that. Regular expressions can be expensive in terms of efficiency. So, you should favor other methods when possible.

For those strings use split ...

use strict; use warnings; my @strings = ( "http://mysite/bbsui.jsp?id=dxpwd", "http://mysite/bbsui.jsp?id=dxpsf", "http://mysite/bbsui.jsp?id=sfpwd", "http://mysite/bbsui.jsp?id=ds35e", "http://mysite/bbsui.jsp?id=124536" ); for ( @strings ) { my ($base, $id) = split( /=/, $_, 2 ); print "Id: $id\n"; }

--
-- Ghodmode
Blessed is he who has found his work; let him ask no other blessedness.
-- Thomas Carlyle

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://565141]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2024-04-20 01:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found