How to use the @microsoft/recognizers-text.RegExpUtility.getFirstMatchIndex function in @microsoft/recognizers-text

To help you get started, we’ve selected a few @microsoft/recognizers-text examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / french / dateTimeConfiguration.ts View on Github external
isConnectorToken(source: string): boolean {

        return (source === "" ||
            RegExpUtility.getFirstMatchIndex(this.prepositionRegex, source).matched ||
            RegExpUtility.getFirstMatchIndex(this.connectorRegex, source).matched);
    }
}
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / french / timePeriodConfiguration.ts View on Github external
getBetweenTokenIndex(text: string): { matched: boolean; index: number; } {
        return RegExpUtility.getFirstMatchIndex(this.beforeRegex, text);
    }
}
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / spanish / datePeriodConfiguration.ts View on Github external
getBetweenTokenIndex(source: string): { matched: boolean; index: number; } {
        return RegExpUtility.getFirstMatchIndex(this.betweenRegex, source);
    }
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / spanish / datePeriodConfiguration.ts View on Github external
getSwiftDayOrMonth(source: string): number {
        let trimedText = source.trim().toLowerCase();
        let swift = 0;

        if (RegExpUtility.getFirstMatchIndex(this.nextPrefixRegex, trimedText).matched) {
            swift = 1;
        }

        if (RegExpUtility.getFirstMatchIndex(this.previousPrefixRegex, trimedText).matched) {
            swift = -1;
        }

        return swift;
    }
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / spanish / dateTimeConfiguration.ts View on Github external
isConnectorToken(source: string): boolean {
        let trimmed = source.trim();
        return trimmed === ""
            || RegExpUtility.getFirstMatchIndex(this.prepositionRegex, source).matched
            || RegExpUtility.getFirstMatchIndex(this.connectorRegex, source).matched;
    }
}
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / french / datePeriodConfiguration.ts View on Github external
getBetweenTokenIndex(source: string): { matched: boolean; index: number; } {
        return RegExpUtility.getFirstMatchIndex(this.beforeRegex, source);
    }
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / spanish / datePeriodConfiguration.ts View on Github external
getSwiftYear(source: string): number {
        let trimedText = source.trim().toLowerCase();
        let swift = -10;
        if (RegExpUtility.getFirstMatchIndex(this.nextPrefixRegex, trimedText).matched) {
            swift = 1;
        }

        if (RegExpUtility.getFirstMatchIndex(this.previousPrefixRegex, trimedText).matched) {
            swift = -1;
        }
        else if (RegExpUtility.getFirstMatchIndex(this.thisPrefixRegex, trimedText).matched) {
            swift = 0;
        }

        return swift;
    }
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / french / timePeriodConfiguration.ts View on Github external
getFromTokenIndex(text: string): { matched: boolean; index: number; } {
        return RegExpUtility.getFirstMatchIndex(this.fromRegex, text);
    }
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / spanish / dateTimePeriodConfiguration.ts View on Github external
getFromTokenIndex(source: string): { matched: boolean; index: number; } {
        return RegExpUtility.getFirstMatchIndex(this.fromRegex, source);
    }
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / spanish / datePeriodConfiguration.ts View on Github external
isLastCardinal(source: string): boolean {
        let trimedText = source.trim().toLowerCase();
        return RegExpUtility.getFirstMatchIndex(this.previousPrefixRegex, trimedText).matched;
    }
}