Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Looking for appropriate Regex

by ww (Archbishop)
on Apr 07, 2013 at 15:31 UTC ( #1027385=note: print w/replies, xml ) Need Help??

in reply to Looking for appropriate Regex

If the sample data are exactly as you posted them (hard to tell since you didn't use code tags),

A B 1234 a,b -> ... A B 1234 c,e -> ....

then it appears to me that you are dealing NOT with CSV. but rather, with SPACE-SEPARATED values (or, perhaps TSV if something in the writeup process transformed tabs to single spaces). If that's the case, you can't solve your problem by treating the data as if it were comma-separated.

OTOH (and again presuming that the OP reflects the data precisely), could this actually be CSV data with just two fields?

If you didn't program your executable by toggling in binary, it wasn't really programming!

Replies are listed 'Best First'.
Re^2: Looking for appropriate Regex
by better (Acolyte) on Apr 07, 2013 at 19:18 UTC

    Well, I parsed variably structured strings, consisting of different characters, like: letters, numbers, space, brackets, minus, comma from a CSV file.

    The CSV file is a database output in the form of an Excel worksheet, saved as a CSV file. The first coloumn contains fields with a series of letters and numbers, called IDs, i.e.

    |A B 1234 a <1>| |A B 1234 a,b|

    In order to look up the image files corresponding to the IDs, I parse the IDs of the CSV file into a text file, which will later be opened as a file handle. During the parsing of the IDs the comma of comma separated letters (like: a,b or c,e) which are part of the ID is accidentally (?) deleted.

    Just to point out the context: The parsing is the first step of a file import, see nodes:

    Read text file - Encoding problem?

    Looking up elements of an array in another array!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1027385]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2018-06-21 00:56 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (117 votes). Check out past polls.