Excel数据导入PG库,字符串正则表达式

1、Excel数据导入到PG库的某张表中:
先将Excel文件转换为CSV格式,打开SQL Shell(psql),连接数据库(输入server,database,Port,username),然后再执行以下命令
copy sdm_nbev_base_fyp_life_assess(organization,plan_code,fyp,version_id) from 'D:UsersEX-JINZHI001Desktop考核寿险基准FYP.csv' with csv header;

2、字符串正则表达式处理:
函数:regexp_matches(string text, pattern text [, flags text])
说明:Return all captured substrings resulting from matching a POSIX regular expression against the string. See Section 9.7.3 for more information. 对字符串按正则表达式进行匹配,如果存在则会在结果数组中表示出来
例子:regexp_matches('foobarbequebaz', '(bar)(beque)') = {bar,beque}

函数:regexp_replace(string text, pattern text, replacement text [, flags text])
说明:Replace substring(s) matching a POSIX regular expression. See Section 9.7.3 for more information. 利用正则表达式对字符串进行替换
例子:regexp_replace('Thomas', '.[mN]a.', 'M') = ThM

函数:regexp_split_to_array(string text, pattern text [, flags text ])
说明:Split string using a POSIX regular expression as the delimiter. See Section 9.7.3 for more information. 利用正则表达式将字符串分割成数组
例子:regexp_split_to_array('hello world', E'\s+') = {hello,world}

函数:regexp_split_to_table(string text, pattern text [, flags text])
说明:Split string using a POSIX regular expression as the delimiter. See Section 9.7.3 for more information. 利用正则表达式将字符串分割成表格
例子:regexp_split_to_table('hello world', E'\s+') =
hello
world
(2 rows)

原文地址:https://www.cnblogs.com/jilly324/p/9228764.html