Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: REGEXP Help

by arunhorne (Pilgrim)
on Jun 24, 2002 at 13:24 UTC ( [id://176777]=note: print w/replies, xml ) Need Help??


in reply to REGEXP Help

First up... if you always have the same lines why don't you just hard code the transformation, i.e $header[0] = "Date/Time"?

Another note is that where you say $header[1] =~ s/^\".*\"$/Date\/Time/; in your script I think you mean $header[0] =~ s/^\".*\"$/Date\/Time/; as array indexing begins at zero...

These points aside you are going to need a regular expression that can cope with the machine name syntax... how about:

s/^\\\\(.*)\\.*$/your_text_here/;

Note that its probably possible to write the above in a neater way due to the escaping of multiple backslahses. The brackets around the first .* in the expression act as a memory allowing you to retrieve the exact text they macthed, in this case the machine name... thus if you wanted to include the machine name in the text that replaces the macthed text you could use \1 or $1. Check out a regex text for information on these.

Hope this helps... your questions a bit vague so clarify it a bit more and i'll try and help some more.

____________
Arun

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-26 08:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found