I only want to "regular expression replacement process" for "Nth column data of CSV" in Hidemaru editor.

Asked 1 years ago, Updated 1 years ago, 57 views

What do you want to do
·In the Hidemaru editor, I want to replace the regular expression of the link destination only for the data in the 9th column of CSV.
CSCSV is separated by ','

What I don't know
·How to obtain data in column N of CSV using regular expressions
*Not CSV data up to column N, but CSV data only

Tried
I was able to get ""only data in column N of CSV"" from the contents on this page, but I have already used regular expression capture replacement, so I cannot use regular expression (in editor) from there."
"·Is there a way to get ""only data in column N of CSV"" using only the regular expression before replacement?"

regular-expression

2022-09-30 16:18

2 Answers

In CSV, you can use commas and line breaks if you enclose them in double quotes, and the double quotes themselves can be expressed in two consecutive characters, so it may be quite difficult to deal with them only with regular expressions.(Personally, it's impossible)
If there is no double quote, I think I can go with the above example.


2022-09-30 16:18

I haven't been able to confirm the results in Hidemaru, but
For example, if you want to add ● to the beginning of the fifth row, how about the following?

 ·Search string
^((?:[^,]*,){4})([^,]*)(,|$)

·Replacement string
\1●\2\3

The above regular expression hits the fifth column of all rows, so
If you only want to hit the foo in the fifth column and replace it with a bar,
You can do the following.

 ·Search string
^((?:[^,]*,){4}[^,]*)(foo)([^,]*?,|$)

·Replacement string
\1bar\3


2022-09-30 16:18

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.