Delete delimiter from columns csv regex

lmelaam

Is there any way to detect only the double quotes that are not surrounded by semi-column or if it is at the end of the line ? Example:

test1;"col11 " col12";"col3" 
test1;"col11" col12";"col3" 
test1;"col11 "col12";"col3" 
test1;"col11"col12";"col3"

Output :

test1;"col11  col12";"col3"
test1;"col11 col12";"col3"
test1;"col11 col12";"col3"
test1;"col11col12";"col3"

I used this regex : \b(?!;"|";|"$|"\n)" but the \b excludes the double quote preceded by a space.

Wiktor Stribiżew

You can use

(?<=[^;\r\n])"(?=[^;\r\n])

See the regex demo.

Details

  • (?<=[^;\r\n]) - immediately on the left, there should be a char other than ;, CR and LF
  • " - a double quote
  • (?=[^;\r\n]) - immediately on the right, there should be a char other than ;, CR and LF.

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

Notepad++ ignoring end delimiter of RegEx

来自分类Dev

“(”或附近的语法错误(从COPY FROM WITH(格式csv,DELIMITER E'\ t',QUOTE'*',HEADER false,编码'UTF8')

来自分类Dev

Python Pandas: Delete duplicate rows based on one column and concatenate information from multiple columns

来自分类Dev

Writing arrays to a csv in columns

来自分类Dev

How to read special character delimiter present in csv files through python?

来自分类Dev

Delete csv files having less than 10 entries from a particular directory in R

来自分类Dev

CSV resize columns depending on the content

来自分类Dev

使用Regex进行CSV清洁

来自分类Dev

How to delete columns with regular expression for the header in R

来自分类Dev

Searching through a CSV with variable number of columns

来自分类Dev

使用Regex清理R中的CSV文件

来自分类Dev

Delete element from List in Scheme

来自分类Dev

Calculate a sum from hidden columns

来自分类Dev

SQL中的DELETE和DELETE FROM之间的区别?

来自分类Dev

Shortest match in regex from end

来自分类Dev

Reading data from a CSV file

来自分类Dev

Group Array from .csv | PHP

来自分类Dev

sqlldr : Load Multiple columns of a csv file in a single column

来自分类Dev

Text :: CSV bind_columns无法正常工作

来自分类Dev

SQL错误:DELETE和SELECT FROM冲突

来自分类Dev

How to delete a file from local disk in UWP

来自分类Dev

Delete a substring from a string with a filename in Perl

来自分类Dev

DELETE FROM - foreach loop on MYSQL database

来自分类Dev

MySQL使用DELETE FROM删除重复的行

来自分类Dev

使用Regex在csv列中替换\ r \ n

来自分类Dev

perl regex CSV文件和列标题处理

来自分类Dev

Perl和Regex-解析.csv中的值

来自分类Dev

使用Pandas和Regex将文件名写入csv

来自分类Dev

如何删除CSV记事本++ / RegEx列?

Related 相关文章

  1. 1

    Notepad++ ignoring end delimiter of RegEx

  2. 2

    “(”或附近的语法错误(从COPY FROM WITH(格式csv,DELIMITER E'\ t',QUOTE'*',HEADER false,编码'UTF8')

  3. 3

    Python Pandas: Delete duplicate rows based on one column and concatenate information from multiple columns

  4. 4

    Writing arrays to a csv in columns

  5. 5

    How to read special character delimiter present in csv files through python?

  6. 6

    Delete csv files having less than 10 entries from a particular directory in R

  7. 7

    CSV resize columns depending on the content

  8. 8

    使用Regex进行CSV清洁

  9. 9

    How to delete columns with regular expression for the header in R

  10. 10

    Searching through a CSV with variable number of columns

  11. 11

    使用Regex清理R中的CSV文件

  12. 12

    Delete element from List in Scheme

  13. 13

    Calculate a sum from hidden columns

  14. 14

    SQL中的DELETE和DELETE FROM之间的区别?

  15. 15

    Shortest match in regex from end

  16. 16

    Reading data from a CSV file

  17. 17

    Group Array from .csv | PHP

  18. 18

    sqlldr : Load Multiple columns of a csv file in a single column

  19. 19

    Text :: CSV bind_columns无法正常工作

  20. 20

    SQL错误:DELETE和SELECT FROM冲突

  21. 21

    How to delete a file from local disk in UWP

  22. 22

    Delete a substring from a string with a filename in Perl

  23. 23

    DELETE FROM - foreach loop on MYSQL database

  24. 24

    MySQL使用DELETE FROM删除重复的行

  25. 25

    使用Regex在csv列中替换\ r \ n

  26. 26

    perl regex CSV文件和列标题处理

  27. 27

    Perl和Regex-解析.csv中的值

  28. 28

    使用Pandas和Regex将文件名写入csv

  29. 29

    如何删除CSV记事本++ / RegEx列?

热门标签

归档