Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 如何提取字符串以获取纬度、经度_Regex - Fatal编程技术网

Regex 如何提取字符串以获取纬度、经度

Regex 如何提取字符串以获取纬度、经度,regex,Regex,这是我的正则表达式 ^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$ 如果我的字符串是这样,我就无法提取经度 我的位置是3.156831101.711125。或者你可以直接搜索 “KLCC” 我试图提取lat,longitude或lat,longitude正则表达式应该是-(\d+\.\d+) 对不起。。我很抱歉。。我不反对投票。谢谢你的回答。它的工作。string regexpatern=“(\\d+\\.\\d+”;string Content=“我的位置是3.

这是我的正则表达式

^(\-?\d+(\.\d+)?),\s*(\-?\d+(\.\d+)?)$
如果我的字符串是这样,我就无法提取经度

我的位置是3.156831101.711125。或者你可以直接搜索 “KLCC”

我试图提取lat,longitude或lat,longitude

正则表达式应该是-
(\d+\.\d+)


对不起。。我很抱歉。。我不反对投票。谢谢你的回答。它的工作。
string regexpatern=“(\\d+\\.\\d+”;string Content=“我的位置是3.156831101.711125。或者您可以直接搜索\“KLCC\”;MatchCollection matchList=Regex.Matches(内容,regexpatern);var list=matchList.Cast().Select(match=>match.Value.ToList()是。它将返回匹配元素的列表或数组。