How to use the @microsoft/recognizers-text.RegExpUtility.getSafeRegExp 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 / english / datePeriodConfiguration.ts View on Github external
constructor(dmyDateFormat: boolean) {
        this.simpleCasesRegexes = [
            RegExpUtility.getSafeRegExp(EnglishDateTime.SimpleCasesRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.BetweenRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.OneWordPeriodRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.MonthWithYear),
            RegExpUtility.getSafeRegExp(EnglishDateTime.MonthNumWithYear),
            RegExpUtility.getSafeRegExp(EnglishDateTime.YearRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.WeekOfMonthRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.WeekOfYearRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.MonthFrontBetweenRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.MonthFrontSimpleCasesRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.QuarterRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.QuarterRegexYearFront),
            RegExpUtility.getSafeRegExp(EnglishDateTime.AllHalfYearRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.SeasonRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.WhichWeekRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.RestOfDateRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.LaterEarlyPeriodRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.WeekWithWeekDayRangeRegex)
        ];
        this.illegalYearRegex = RegExpUtility.getSafeRegExp(BaseDateTime.IllegalYearRegex);
        this.YearRegex = RegExpUtility.getSafeRegExp(EnglishDateTime.YearRegex);
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / french / holidayConfiguration.ts View on Github external
constructor() {
        this.holidayRegexes = [
            RegExpUtility.getSafeRegExp(FrenchDateTime.HolidayRegex1, "gis"),
            RegExpUtility.getSafeRegExp(FrenchDateTime.HolidayRegex2, "gis"),
            RegExpUtility.getSafeRegExp(FrenchDateTime.HolidayRegex3, "gis"),
            RegExpUtility.getSafeRegExp(FrenchDateTime.HolidayRegex4, "gis")
        ];
    }
}
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / english / setConfiguration.ts View on Github external
constructor(dmyDateFormat: boolean) {
        this.durationExtractor = new BaseDurationExtractor(new EnglishDurationExtractorConfiguration());
        this.timeExtractor = new BaseTimeExtractor(new EnglishTimeExtractorConfiguration());
        this.dateExtractor = new BaseDateExtractor(new EnglishDateExtractorConfiguration(dmyDateFormat));
        this.dateTimeExtractor = new BaseDateTimeExtractor(new EnglishDateTimeExtractorConfiguration(dmyDateFormat));
        this.datePeriodExtractor = new BaseDatePeriodExtractor(new EnglishDatePeriodExtractorConfiguration(dmyDateFormat));
        this.timePeriodExtractor = new BaseTimePeriodExtractor(new EnglishTimePeriodExtractorConfiguration());
        this.dateTimePeriodExtractor = new BaseDateTimePeriodExtractor(new EnglishDateTimePeriodExtractorConfiguration(dmyDateFormat));
        this.lastRegex = RegExpUtility.getSafeRegExp(EnglishDateTime.SetLastRegex);
        this.eachPrefixRegex = RegExpUtility.getSafeRegExp(EnglishDateTime.EachPrefixRegex);
        this.periodicRegex = RegExpUtility.getSafeRegExp(EnglishDateTime.PeriodicRegex);
        this.eachUnitRegex = RegExpUtility.getSafeRegExp(EnglishDateTime.EachUnitRegex);
        this.eachDayRegex = RegExpUtility.getSafeRegExp(EnglishDateTime.EachDayRegex);
        this.setWeekDayRegex = RegExpUtility.getSafeRegExp(EnglishDateTime.SetWeekDayRegex);
        this.setEachRegex = RegExpUtility.getSafeRegExp(EnglishDateTime.SetEachRegex);
        this.beforeEachDayRegex = null;
    }
}
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-number / src / number / french / extractors.ts View on Github external
constructor(placeholder: string = FrenchNumeric.PlaceHolderDefault) {
        super();

        let regexes = new Array(
            {
                regExp: RegExpUtility.getSafeRegExp(FrenchNumeric.DoubleDecimalPointRegex(placeholder)),
                value: "DoubleNum"
            },
            {
                regExp: RegExpUtility.getSafeRegExp(FrenchNumeric.DoubleWithoutIntegralRegex(placeholder)),
                value: "DoubleNum"
            },
            {
                regExp: RegExpUtility.getSafeRegExp(FrenchNumeric.DoubleWithMultiplierRegex, "gs"),
                value: "DoubleNum"
            },
            {
                regExp: RegExpUtility.getSafeRegExp(FrenchNumeric.DoubleWithRoundNumber),
                value: "DoubleNum"
            },
            {
                regExp: RegExpUtility.getSafeRegExp(FrenchNumeric.DoubleAllFloatRegex),
                value: "Double" + FrenchNumeric.LangMarker
            },
            {
                regExp: RegExpUtility.getSafeRegExp(FrenchNumeric.DoubleExponentialNotationRegex),
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / english / dateConfiguration.ts View on Github external
this.implicitDateList = [
            RegExpUtility.getSafeRegExp(EnglishDateTime.OnRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.RelaxedOnRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.SpecialDayRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.SpecialDayWithNumRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.ThisRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.LastDateRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.NextDateRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.SingleWeekDayRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.WeekDayOfMonthRegex),
            RegExpUtility.getSafeRegExp(EnglishDateTime.SpecialDate),
            RegExpUtility.getSafeRegExp(EnglishDateTime.RelativeWeekDayRegex),
        ];
        this.monthEnd = RegExpUtility.getSafeRegExp(EnglishDateTime.MonthEnd);
        this.ofMonth = RegExpUtility.getSafeRegExp(EnglishDateTime.OfMonth);
        this.dateUnitRegex = RegExpUtility.getSafeRegExp(EnglishDateTime.DateUnitRegex);
        this.forTheRegex = RegExpUtility.getSafeRegExp(EnglishDateTime.ForTheRegex);
        this.weekDayAndDayOfMonthRegex = RegExpUtility.getSafeRegExp(EnglishDateTime.WeekDayAndDayOfMonthRegex);
        this.relativeMonthRegex = RegExpUtility.getSafeRegExp(EnglishDateTime.RelativeMonthRegex);
        this.strictRelativeRegex = RegExpUtility.getSafeRegExp(EnglishDateTime.StrictRelativeRegex);
        this.weekDayRegex = RegExpUtility.getSafeRegExp(EnglishDateTime.WeekDayRegex);
        this.dayOfWeek = EnglishDateTime.DayOfWeek;
        this.ordinalExtractor = new EnglishOrdinalExtractor();
        this.integerExtractor = new EnglishIntegerExtractor();
        this.numberParser = new BaseNumberParser(new EnglishNumberParserConfiguration());
        this.durationExtractor = new BaseDurationExtractor(new EnglishDurationExtractorConfiguration());
        this.utilityConfiguration = new EnglishDateTimeUtilityConfiguration();
    }
}
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / spanish / dateTimeConfiguration.ts View on Github external
constructor(dmyDateFormat: boolean) {
        this.prepositionRegex = RegExpUtility.getSafeRegExp(SpanishDateTime.PrepositionRegex, "gis");
        this.nowRegex = RegExpUtility.getSafeRegExp(SpanishDateTime.NowRegex, "gis");
        this.suffixRegex = RegExpUtility.getSafeRegExp(SpanishDateTime.SuffixRegex, "gis");

        this.timeOfDayRegex = RegExpUtility.getSafeRegExp(SpanishDateTime.TimeOfDayRegex, "gis");
        this.specificTimeOfDayRegex = RegExpUtility.getSafeRegExp(SpanishDateTime.SpecificTimeOfDayRegex, "gis");
        this.timeOfTodayAfterRegex = RegExpUtility.getSafeRegExp(SpanishDateTime.TimeOfTodayAfterRegex, "gis");
        this.timeOfTodayBeforeRegex = RegExpUtility.getSafeRegExp(SpanishDateTime.TimeOfTodayBeforeRegex, "gis");
        this.simpleTimeOfTodayAfterRegex = RegExpUtility.getSafeRegExp(SpanishDateTime.SimpleTimeOfTodayAfterRegex, "gis");
        this.simpleTimeOfTodayBeforeRegex = RegExpUtility.getSafeRegExp(SpanishDateTime.SimpleTimeOfTodayBeforeRegex, "gis");
        this.specificEndOfRegex = RegExpUtility.getSafeRegExp(SpanishDateTime.SpecificEndOfRegex, "gis");
        this.unspecificEndOfRegex = RegExpUtility.getSafeRegExp(SpanishDateTime.UnspecificEndOfRegex, "gis");
        this.unitRegex = RegExpUtility.getSafeRegExp(SpanishDateTime.UnitRegex, "gis");
        this.connectorRegex = RegExpUtility.getSafeRegExp(SpanishDateTime.ConnectorRegex, "gis");
        this.nightRegex = RegExpUtility.getSafeRegExp(SpanishDateTime.NightRegex, "gis");

        this.datePointExtractor = new BaseDateExtractor(new SpanishDateExtractorConfiguration(dmyDateFormat));
        this.timePointExtractor = new BaseTimeExtractor(new SpanishTimeExtractorConfiguration());
        this.durationExtractor = new BaseDurationExtractor(new SpanishDurationExtractorConfiguration());
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-number / src / number / english / extractors.ts View on Github external
value: "DoubleNum"
            },
            {
                regExp: RegExpUtility.getSafeRegExp(EnglishNumeric.DoubleWithoutIntegralRegex(placeholder), "gis"),
                value: "DoubleNum"
            },
            {
                regExp: this.generateLongFormatNumberRegexes(LongFormatType.doubleNumCommaDot, placeholder),
                value: "DoubleNum"
            },
            {
                regExp: this.generateLongFormatNumberRegexes(LongFormatType.doubleNumNoBreakSpaceDot, placeholder),
                value: "DoubleNum"
            },
            {
                regExp: RegExpUtility.getSafeRegExp(EnglishNumeric.DoubleWithMultiplierRegex, "gs"),
                value: "DoubleNum"
            },
            {
                regExp: RegExpUtility.getSafeRegExp(EnglishNumeric.DoubleWithRoundNumber, "gis"),
                value: "DoubleNum"
            },
            {
                regExp: RegExpUtility.getSafeRegExp(EnglishNumeric.DoubleAllFloatRegex, "gis"),
                value: "DoubleEng"
            },
            {
                regExp: RegExpUtility.getSafeRegExp(EnglishNumeric.DoubleExponentialNotationRegex, "gis"),
                value: "DoublePow"
            },
            {
                regExp: RegExpUtility.getSafeRegExp(EnglishNumeric.DoubleCaretExponentialNotationRegex, "gis"),
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / chinese / datePeriodConfiguration.ts View on Github external
constructor(dmyDateFormat: boolean) {
        this.simpleCasesRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.SimpleCasesRegex);
        this.yearRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.YearRegex);
        this.seasonRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.SeasonRegex);
        this.seasonMap = ChineseDateTime.ParserConfigurationSeasonMap;
        this.quarterRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.QuarterRegex);
        this.cardinalMap = ChineseDateTime.ParserConfigurationCardinalMap;
        this.unitMap = ChineseDateTime.ParserConfigurationUnitMap;
        this.durationExtractor = new ChineseDurationExtractor();
        this.pastRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.PastRegex);
        this.futureRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.FutureRegex);
        this.monthOfYear = ChineseDateTime.ParserConfigurationMonthOfYear;
        this.dayOfMonth = ChineseDateTime.ParserConfigurationDayOfMonth;
        this.monthOfYear = ChineseDateTime.ParserConfigurationMonthOfYear;
        this.oneWordPeriodRegex = RegExpUtility.getSafeRegExp(ChineseDateTime.OneWordPeriodRegex);
        this.dateExtractor = new ChineseDateExtractor(dmyDateFormat);
        this.dateParser = new ChineseDateParser(dmyDateFormat);
        this.tokenBeforeDate = 'on ';
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / french / dateTimeConfiguration.ts View on Github external
constructor(config: ICommonDateTimeParserConfiguration) {
        this.tokenBeforeDate = FrenchDateTime.TokenBeforeDate;
        this.tokenBeforeTime = FrenchDateTime.TokenBeforeTime;
        this.nowRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.NowRegex, "gis");
        this.amTimeRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.AMTimeRegex, "gis");
        this.pmTimeRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.PMTimeRegex, "gis");
        this.simpleTimeOfTodayAfterRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.SimpleTimeOfTodayAfterRegex, "gis");
        this.simpleTimeOfTodayBeforeRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.SimpleTimeOfTodayBeforeRegex, "gis");
        this.specificTimeOfDayRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.SpecificTimeOfDayRegex, "gis");
        this.specificEndOfRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.SpecificEndOfRegex, "gis");
        this.unspecificEndOfRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.UnspecificEndOfRegex, "gis");
        this.unitRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.TimeUnitRegex, "gis");

        this.dateExtractor = config.dateExtractor;
        this.timeExtractor = config.timeExtractor;
        this.dateParser = config.dateParser;
        this.timeParser = config.timeParser;
        this.numbers = config.numbers;
        this.cardinalExtractor = config.cardinalExtractor;
        this.numberParser = config.numberParser;
        this.durationExtractor = config.durationExtractor;
        this.durationParser = config.durationParser;
        this.unitMap = config.unitMap;
        this.utilityConfiguration = config.utilityConfiguration;
    }
github microsoft / Recognizers-Text / JavaScript / packages / recognizers-date-time / src / dateTime / french / dateConfiguration.ts View on Github external
this.cardinalExtractor = config.cardinalExtractor;
        this.durationExtractor = config.durationExtractor;
        this.numberParser = config.numberParser;
        this.durationParser = config.durationParser;
        this.monthOfYear = config.monthOfYear;
        this.dayOfMonth = config.dayOfMonth;
        this.dayOfWeek = config.dayOfWeek;
        this.unitMap = config.unitMap;
        this.cardinalMap = config.cardinalMap;
        this.dateRegex = new FrenchDateExtractorConfiguration(dmyDateFormat).dateRegexList;
        this.onRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.OnRegex, "gis");
        this.specialDayRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.SpecialDayRegex, "gis");
        this.specialDayWithNumRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.SpecialDayWithNumRegex, "gis");
        this.nextRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.NextDateRegex, "gis");
        this.unitRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.DateUnitRegex, "gis");
        this.monthRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.MonthRegex, "gis");
        this.weekDayRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.WeekDayRegex, "gis");
        this.strictWeekDay = RegExpUtility.getSafeRegExp(FrenchDateTime.StrictWeekDay, "gis");
        this.lastRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.LastDateRegex, "gis");
        this.thisRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.ThisRegex, "gis");
        this.weekDayOfMonthRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.WeekDayOfMonthRegex, "gis");
        this.forTheRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.ForTheRegex, "gis");
        this.weekDayAndDayOfMonthRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.WeekDayAndDayOfMonthRegex, "gis");
        this.relativeMonthRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.RelativeMonthRegex, "gis");
        this.strictRelativeRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.StrictRelativeRegex, "gis");
        this.relativeWeekDayRegex = RegExpUtility.getSafeRegExp(FrenchDateTime.RelativeWeekDayRegex, "gis");
        this.utilityConfiguration = config.utilityConfiguration;
        this.dateTokenPrefix = FrenchDateTime.DateTokenPrefix;
    }