PowerBuilder - 有限的正则表达式

时间:2016-05-24 05:28:09

标签: regex powerbuilder

可接受的格式:

0
1,2
1,100,2000,30000
etc...

正则表达式:

Match(a_s_stat, "^\d+(,\d+)*$")

该函数返回false。字符串a_s_stat是:0,1

如何在PowerBuilder 9.0中正确保存正则表达式?

1 个答案:

答案 0 :(得分:0)

此代码应该可以解决您的问题 - 尽管不像“真正的”正则表达式那样令人愉快

if Match(data, "^[0-9]+$") or &
    ( Match(data, "^[0-9]+[,0-9]*[0-9]+$") and not Match(data, ",,") ) then
    statusText = "<data> is list of integers"
else
    statusText = "Cannot interpret <data> as list of integers"
end if