Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^4: How regex works in array mode?

by astronogun (Sexton)
on Apr 26, 2012 at 09:12 UTC ( #967276=note: print w/replies, xml ) Need Help??

in reply to Re^3: How regex works in array mode?
in thread How regex works in array mode?

I already replace it and the output is:

but it doesn't print the "ip:" Is it possible to print the next value in the array? Thanks

or is this output possible?

ip: ip:

Replies are listed 'Best First'.
Re^5: How regex works in array mode?
by JavaFan (Canon) on Apr 26, 2012 at 10:02 UTC
    Perhaps you haven't replaced it correctly?
    use 5.010; my @lines = ("ip:", "ip:" =~ /(ip:[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/); say for @lines; __END__ ip: ip:
    Do note that ip: is in @lines only because the pattern matches the entire string. And do note that "ip:" is not subject to any matching. In fact, the assignment to @lines is equivalent with:
    my @lines; $lines[0] = "ip:"; push @lines, $1 if "ip:" =~ /(ip:[0-9]{1,3}\.[0-9]{1,3}\. +[0-9]{1,3}\.[0-9]{1,3})/;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://967276]
[marto]: when you work on the outside, for a client, you can make them aware of the stupids, but they don' t always listen :/
[Corion]: Yeah, you can lead them to water, but it's illegal to drown them...
[Discipulus]: Here my solution marto: create a win fake machine insied AD. do a micro fake partition foreach remote partition you wont to monit. put a web server that acept from data from remote systems and full fake partition as needed. fake partition are Mb. ;=)
[marto]: Discipulus yeah, the nuclear industry love fake machines sitting around on a controlled domain :P
[marto]: changing a typo on a website is often a great deal of paper work :P

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (10)
As of 2017-01-24 10:39 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (203 votes). Check out past polls.