Something went wrong. Try again.
fork of hey-api/openapi-ts because I need some additional things
Something went wrong. Try again.
1.3 kB · 41 lines
TypeScript
123456789101112131415161718192021222324252627282930313233343536373839404142/** * Matches characters from the start that are not valid Python identifier starts. * Python identifiers: starts with letter/underscore, followed by letters/digits/underscores. */const illegalStartCharactersRegExp = /^[^a-zA-Z_]+/;
/** * Matches if string contains only digits and optionally decimal point or leading minus. */const numberRegExp = /^-?\d+(\.\d+)?$/;
/** * Python identifier pattern: starts with letter or underscore, * followed by letters, digits, or underscores. * Uses Unicode categories for full Python 3 compliance. */const validPythonIdentifierRegExp = /^[a-zA-Z_][a-zA-Z0-9_]*$/u;
/** * Matches if a string looks like a valid Python identifier. */const looksLikeIdentifierRegExp = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
export const regexp = { /** * Matches characters from the start that are not valid Python identifier starts. */ illegalStartCharacters: illegalStartCharactersRegExp, /** * Simpler pattern for quick identifier checks. */ looksLikeIdentifier: looksLikeIdentifierRegExp, /** * Matches if string contains only digits and optionally decimal point or leading minus. */ number: numberRegExp, /** * Python identifier pattern for validation. */ pythonIdentifier: validPythonIdentifierRegExp,};