Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Search and replace the word in Column 16

by davidrw (Prior)
on Jul 25, 2006 at 12:32 UTC ( [id://563501]=note: print w/replies, xml ) Need Help??


in reply to Search and replace the word in Column 16

i agree with jdtoronto's and davorg's split suggestion ...

Another posibility (especially if there can be escaped delimiters) is to use one of the CSV modules to parse it.

If you really wanted to fix the regex (i suspect that would be less efficient and less readable than split), something like:
$idx =~ s/^((?:[^|]*\|){15}[^|]*)STOCK/$1BOXXE/;
It's also possible (obviously relies on assumptions) for you to get away with just dropping the /g modifier .. then it would only break if "STOCK" also appeared in columns 1-15 somewhere, but would not break if it was in column 17+.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2024-04-19 15:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found