跳到主要内容

GetRegularExp

获取文本小部件的正则验证表达式。

语法

expression.GetRegularExp();

expression - 表示 ApiTextWidget 类的变量。

参数

此方法没有任何参数。

返回值

boolean

示例

从 PDF 中的文本字段检索验证模式。

// How do I access the validation pattern from a text field in a PDF?

// Display what text pattern is required for a text field in a PDF.

let doc = Api.GetDocument();
let page = doc.GetPage(0);
let comboboxField = Api.CreateComboboxField([10, 10, 160, 30]);
page.AddObject(comboboxField);

let widgets = comboboxField.GetAllWidgets();
widgets[0].SetRegularExp('\S+@\S+\.\S+');
console.log('Text widget reg exp is: "' + widgets[0].GetRegularExp() + '"');