Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I have a csv file like this:
11111111111 22222222222 33333333333333 xxxxxxxxxx
where the delimiter look like a single or multiple spaces.
In addition to that, the last column may contains spaces.
What is the best practice to read a similar file?
Thanks in advance.
I am assuming that only last column can have space.
"^\\s*(\\w+)\\s+(\\w+)\\s+(\\w+)\\s+(.*)"
Does your schema is static or Dynamic ? Do you know many fields(Without space) your input can have ?
Thanks Abhishek KUMAR for your reply.
The input file has always 4 columns, but the positions of the fields may change.i.e.:
11111111111 22222222222 333333333333 xxxxxxxxxxxxxx or
11111111111 22222222222 333333333333 xxxx or
11111111111 22222222222 333333333333 xxxxxxxxxx or ....
Regards
try tFileInputregex
with regex expression
"^\\s*(\\w+)\\s+(\\w+)\\s+(\\w+)\\s+(\\w+)\\s*"
Thank you again.
At first glance, it's works.
But when the last column contains space, it split the value and get only the first part.
Can you update the regex expression to resolve this issue?
Regards
I am assuming that only last column can have space.
"^\\s*(\\w+)\\s+(\\w+)\\s+(\\w+)\\s+(.*)"
Thanks a lot, its works fine now.
Regards