正则表达式的字符串 [英] Regex for the string

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

问题描述

请程序员,当谈到正则表达式时,我不是goot。

拜托,你能提供与这个字符串匹配的正则表达式X | 3.20 | S | 0



我尝试了什么:



还没有,因为我不知道。

解决方案

尝试:

(。+?\ |){3} 0 

可能不会帮助你 - 你需要查看整个负载更多的数据样本...


不清楚你想做什么,但你也可以尝试这个正则表达式

 \ b((X /)?X \ | [0-9] \。[0-9] {2} \ | S \\ \\ | [0-9] {1})\ b 





示例: cp_reg_string在X | 3.20 | S | 0 |之间C#在线编译器| .NET小提琴 [ ^ ]


< blockquote>这个应该这样做:

 \ sX \ | 3 \。20 \ | S\ | 0 





只是一些有趣的链接,可帮助构建和调试RegEx。

以下是RegEx文档的链接:

perlre - perldoc.perl.org [ ^ ]

以下是帮助构建RegEx并调试它们的工具的链接:

< a href =http://regexstorm.net/tester> .NET正则表达式测试程序 - 正则表达式风暴 [ ^ ]

Expresso正则表达式工具 [ ^ ]

RegExr:Learn,Build,&测试RegEx [ ^ ]

在线正则表达式测试器和调试器:PHP,PCRE,Python,Golang和JavaScript [ ^ ]

这个显示RegEx是一个很好的图表,它非常有助于理解RegEx的作用:

Debuggex:在线可视正则表达式测试器。 JavaScript,Python和PCRE。 [ ^ ]

这个网站也在一个漂亮的图表中显示正则表达式,但无法测试与RegEx匹配的内容:

Regexper [ ^ ]


please programmers, I am not goot atall when it comes to regex.
please, can you provide the regex that match this string " X|3.20|S|0"

What I have tried:

nothing yet as I don't know it.

解决方案

Try:

(.+?\|){3}0

Probably won't help you though - you need to look at a whole load more data samples...


Not clear what you trying to do, but you also can try this regular expression

\b((X/)?X\|[0-9]\.[0-9]{2}\|S\|[0-9]{1})\b



Example: cp_reg_string between X|3.20|S|0 | C# Online Compiler | .NET Fiddle[^]


This one should do:

\sX\|3\.20\|S\|0



Just a few interesting links to help building and debugging RegEx.
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
RegExr: Learn, Build, & Test RegEx[^]
Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]
This site also show the Regex in a nice graph but can't test what match the RegEx:
Regexper[^]


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

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