目标 - 从随机传入字符串模式中提取十进制数据(长度信息)。 [英] Objective - To extract the decimal data (length information) from the random incoming string patterns.

查看:75
本文介绍了目标 - 从随机传入字符串模式中提取十进制数据(长度信息)。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目标 - 从随机传入的字符串模式中提取十进制数据(长度信息)。

示例传入字符串模式 -

模式1-一些文本。该项目的总管长为1234.5米。一些文字...

模式2-一些文本。总计这个项目的管道长度500.0米一些文字......

模式3-一些文本。总管道长度为这个项目是7000.5米。一些文字...



请注意,我们在此字符串之前和之后的信息很少。所以,我只能找到共同的起点是总管长。还要注意,没有标准的方法来提及长度,在少数消息中我们收到十进制值和单位之间的空格,在其他一些中找不到。也有一些消息甚至错过了最后的句号。



虽然我找到了一个粗略的解决方案,但是如果我能得到一个标准的方法,我将非常感激从随机传入的字符串中获取此信息。



另一个关键信息:我可以在代码后面(服务器端)执行此操作,这将为我提供访问权限在REGEX库框架上。



提前谢谢。

Objective - To extract the decimal data (length information) from the random incoming string patterns.
Sample Incoming string patterns -
Pattern 1- some text. Total Pipe length for this project are 1234.5 m. some text...
Pattern 2- some text.Total Pipe length for this project 500.0 m some text...
Pattern 3- some text.Total Pipe length for this project are 7000.5m. some text...

Please note, we have few information before and after this string. So, I could only find the common starting point to be "Total Pipe length". Also note there is no standard way to mention the length, in few messages we receive a space between the decimal value and the unit which is found missing in some other. Also few messages even misses out full stop at the end.

Though I have found a rough solution, however I would be really grateful if I can get a standard way of fetching this information from random incoming string.

Another key information: I am ok to do it at code behind (server side) which will give me the access on the REGEX library of framework.

Thanks in advance.

推荐答案

我从这开头:总管道长度。*?(?'长度'[\\\\。] +)m 并查看点击次数和失误次数。



我们这里有一个正则表达式论坛。
I'd start with this: Total Pipe length.*?(?'Length'[\d\.]+)m and see what hits and what misses.

And we have a Regular Expressions forum here.


这篇关于目标 - 从随机传入字符串模式中提取十进制数据(长度信息)。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆