Following is an Example of Regular Expressions :
static void TextBuffer_regularExpression(Args _args)
{
TextBuffer txt = new TextBuffer();
str msg = "ABCDXYZ";
txt.setText(msg);
txt.regularExpressions(true); // activate regular expr in search
// Regular expression to validate only digits
if (txt.find("^[A-Z]+$"))
{
info("string contains only alphabets");
}
}
static void TextBuffer_regularExpression(Args _args)
{
TextBuffer txt = new TextBuffer();
str msg = "ABCDXYZ";
txt.setText(msg);
txt.regularExpressions(true); // activate regular expr in search
// Regular expression to validate only digits
if (txt.find("^[A-Z]+$"))
{
info("string contains only alphabets");
}
}
No comments:
Post a Comment