Replies: 1 comment
-
Temporary solution: export function charIn(chars: string | RegExp): Input {
if (chars instanceof RegExp) return createInput(chars.source)
return createInput(`[${chars.replace(/[-\\^\]]/g, '\\$&')}]`)
} const positiveInteger = charIn(/[1-9]/).and(digit.times.any())
const commonSeparator = charIn(/[-_\s.]/)
const boundary = charIn(/[-_\s()\/:]/)
const lookbehind = createInput(`(?<=^|${BOUNDARY})`)
const lookahead = createInput(`(?=${BOUNDARY}|$)`) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
About
\s
charIn('-\\s')
=>[\-\\s]
charIn('-\s')
=>[\-s]
charIn('-${whitespace}')
=>[\-\\s]
How to solve this problem?
/0|[1-9]\d*/
Also, is there a more concise way to write it?:
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions