/** * Core group manipulation functions without dependencies on global prototype extensions. * This module provides fundamental group manipulation capabilities that can be used * by other modules without creating circular dependencies. */ export declare const dedup: (s: string) => string; /** * Converts a value to a string representation suitable for regex patterns. * If the input is a RegExp, returns its source pattern. Otherwise, converts to string. * * @param child - The value to convert (RegExp, string, number, or undefined) * @returns The string representation of the input value */ export declare const asString: (child: RegExp | string | number | undefined) => string; export declare function patternHasUnicode(p: string | RegExp): boolean; /** * Similar to String.raw * * Builds a raw string from template literals, allowing substitution of regex patterns. * This function processes template strings and interpolates values, converting RegExp objects * to their source patterns while keeping other values as strings. * * @param strings - Template string array from tagged template literal * @param vals - Array of values to interpolate (string, number, or RegExp) * @returns The constructed string with interpolated values * * @example * const pattern = r`word${/\d+/}end`; // "word\\d+end" */ export declare function r(strings: TemplateStringsArray, ...vals: Array): string; export declare function _simpleWithParsers(rx: RegExp, parsers?: any): RegExp; /** * Builds a RegExp from a template string, allowing interpolation of regex patterns. * This function processes template strings and interpolates values, combining flags * and parsers from RegExp objects while converting other values to strings. * * @param strings - Template string array from tagged template literal * @param vals - Array of values to interpolate (string, number, or RegExp) * @returns A new RegExp with combined flags and parsers * * @example * const count = 5; * const pattern5: RegExp = re`\d{${count}}` // equivalent to /\d{5}/ * re`abc${5}def${6}ghi` => re(["abc", "def", "ghi"], 5, 6) */ export declare function re(strings: TemplateStringsArray, ...vals: Array): RegExp; export declare const disallowedGroupNames: string[]; /** * Gets the name of a single named group from a RegExp pattern. * Returns undefined if the pattern doesn't contain exactly one named group. */ export declare function getGroupName(rx: string | RegExp): string | undefined; /** * Gets all named group names from a RegExp pattern. */ export declare function getAllGroupNames(rx: string | RegExp): string[]; /** * Renames a named group in a RegExp pattern from one name to another. * Creates a new RegExp with the specified named group renamed while preserving * all other aspects of the pattern including flags, quantifiers, and structure. * * @param pattern - The RegExp pattern containing the named group to rename * @param newName - The new name for the named group * @returns A new RegExp with the named group renamed * * @throws {Error} If the newName is disallowed or already exists in the pattern */ export declare function simpleRename(pattern: string | RegExp, newName: string): RegExp; export declare function simplePrependName(pattern: string | RegExp, prefix: string): RegExp; export declare function templateGroup(pattern: string | RegExp, newName?: string, groupsParser?: (g: any) => any): RegExp; type TemplateFunc = (strings: TemplateStringsArray, ...vals: Array) => any; /** * Creates a function that stacks multiple template functions together. * This allows chaining template functions without nested template literals. * Functions are applied in reverse order (right to left). * * @param funcs - Array of template functions to stack * @returns A new template function that applies all functions in sequence * * @example * // Instead of: a`${b`text${5}`}` * // Use: stack(a,b)`text${5}` */ export declare function stack(...funcs: TemplateFunc[]): (strings: TemplateStringsArray, ...vals: Array) => RegExp; /** * Alias for the stack function. * Provides a shorter name for convenience. */ export declare const k: typeof stack; export {}; //# sourceMappingURL=core.d.ts.map