且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

正则表达式模式匹配给定的示例单词

更新时间:2023-02-21 11:37:34

如果你想要以下样本输出的正则表达式模式:

text.45

example.90 >
value.46

然后尝试:

If you want regex pattern for the following sample outputs:
text.45
example.90
value.46
then try:
\b[a-zA-Z]*[.][\d][\d]\b



否则,如果你只需要这些字母:

text

示例



然后尝试:


Else if you only want those alphabets:
text
example
value
then try:

\b[a-zA-Z]*(?=[.][\d][\d]\b)





++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++++++++++++++++++ b $ b



+++++++++++++++++++++++++++++++++++++++++
[amended upon re-understanding]

\b[a-zA-Z]+[.][\d][\d]\b



实际上只需将'*'更改为'+'


actually just need to change the '*' to '+'


尝试:

Try:
[^\d]*\d+