关于正则表达式 [英] regarding regular expression

查看:69
本文介绍了关于正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我想在以下字符串中为6.4和2.5的精确匹配创建/编写一个正则表达式:"abc 6.4 xyz 2.5"

请帮助或分享您的想法.

问候,
YRishi

Dear All,

I want create/write a regular expression for exact match of 6.4 and 2.5 in following string: "abc 6.4 xyz 2.5"

Please help or share your thoughts.

Regards,
YRishi

推荐答案

.*\s(\d\.\d)\s.*\s(\d\.\d)或者,如果数字可以更长(例如12.34).*\s(\d+\.\d+)\s.*\s(\d+\.\d+)
.*\s(\d\.\d)\s.*\s(\d\.\d) Or, if the numbers can be longer (e.g. 12.34) .*\s(\d+\.\d+)\s.*\s(\d+\.\d+)


本页:
http://regexlib.com/ [ ^ ]

您可以在此处测试正则表达式:
http://regex.larsolavtorvik.com/ [ ^ ]

希望您会发现它有用=)
You must see this page:
http://regexlib.com/[^]

You can test your regular expression here:
http://regex.larsolavtorvik.com/[^]

Hope you can find it useful =)


这很简单,表达式看起来像这样:
(\ s \ d \ [.] \ d \ s)

您应该签出此工具以编写正则表达式.过去肯定对我有很大帮助:
Expresso-用于构建和测试正则表达式的工具 [ ^ ]
This is simple, the expreccion could look like this:
(\s\d\[.]\d\s)

You should check out this tool fo rwriting Regular Expressions. It sure helpt me a lot in the past:
Expresso - A Tool for Building and Testing Regular Expressions[^]


这篇关于关于正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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