简体   繁体   中英

Replace JSON key with Regex

如何使用正则表达式将'{"a_b": "a_bc", "de_": "b_de", "ab_dc": 12342}'为以下内容:

'{"ab": "a_bc", "de": "b_de", "abdc": 12342}'

Just for your particular test case:

https://regex101.com/r/dwTbTM/2

The crucial regex pattern: /\\"([az]+)_(\\w+)?\\":/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM