🗂

RegExp of Table Markdown

2022/01/18に公開

Pattern

1 row

|columnname|columnname|

/.*[|].*[|].*[|].*/
2 row
column_name column_name
/.*[|].*[|].*[|].*.*\n.*[|].*[|].*[|].*/
2 row - ignoring newline

|column_name|column_name||-----------|-----------|

/.*[|].*[|].*[|].*[|].*[|].*[|].*/
2 row - both
/.*[|].*[|].*[|].*.*\n.*[|].*[|].*[|].*|.*[|].*[|].*[|].*[|].*[|].*[|].*/
3 row
column_name column_name
column_value column_value
/.*[|].*[|].*[|].*.*\n.*[|].*[|].*[|].*\n.*[|].*[|].*[|].*/
3 row - ignoring newline

|column_name |column_name ||------------|------------||column_value|column_value|

/.*[|].*[|].*[|].*[|].*[|].*[|].*[|].*[|].*[|].*/
3 row - both
/.*[|].*[|].*[|].*.*\n.*[|].*[|].*[|].*\n.*[|].*[|].*[|].*|.*[|].*[|].*[|].*[|].*[|].*[|].*[|].*[|].*[|].*/
In Many columns case, you can use introduced RegExp

|column_name |column_name |column_name |column_name |

column_name column_name column_name column_name
column_name column_name column_name column_name
column_value column_value column_value column_value

Discussion