Ax 2012

Check with Regexp if company name follows certain pattern

In my case I was looking for 2 U letters anywhere in the name or the short name of the company.

static void Job107(Args _args)
{
    TextBuffer companyShort = new TextBuffer();
    TextBuffer companyName = new TextBuffer();

    companyShort.setText(curext());
    companyShort.regularExpressions(true);
    companyName.setText(CompanyInfo::find().Name);
    companyName.regularExpressions(true);
    if (companyName.find(‘u.*u’) ||companyShort.find(‘u.*u’))
    {
        info(‘^.^’);
    }
}

Nice links to check regexp stuff : http://www.zytrax.com/tech/web/regex.htm 

And online editor to check if you were right: https://regex101.com/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s