用于在方括号,逗号和引号[]中提取文本的正则表达式,“

问题描述 投票:-1回答:1

我想提取所有4个字段。请帮助我

这里是数据库结构:

[12.345,-12.34567,"title 34","12345"],[-12.987,12.765,"title 36","7689"]

12.345 = latitude data with number and point and dash
-12.34567 = longitude data with number and point and dash
title 34 = text with space and number
12345 = number id with number

我想得到这个结果

1 = 12.345
2 = -12.34567
3 = title 34
4 = 12345

我已经测试了许多解决方案,但没有成功这个例子帮助我迈出了第一步,但并不完全Regular expression to extract text between square brackets

非常感谢您的答复:-)

regex comma brackets quote
1个回答
0
投票

尝试一下:\[(?'lat'[-.0-9]+),(?'long'[-.0-9]+),\"(?'text'[^\"]+)\",\"(?'id'\d+)\"\]结果按名称分组。

这里是显示示例的链接:https://regex101.com/r/YNv8qr/1

© www.soinside.com 2019 - 2024. All rights reserved.