magic-regexp icon indicating copy to clipboard operation
magic-regexp copied to clipboard

differentiate lowercase letter, uppercase letter, or combine them

Open hi-reeve opened this issue 2 years ago â€ĸ 1 comments

🆒 Your use case

right now the function letter is include all the uppercase and lowercase letter, my use case is i only need the lowercase letter, and uppercase letter is prohibited.

🔍 Alternatives you've considered

No response

ℹī¸ Additional info

No response

hi-reeve avatar Jul 29 '22 05:07 hi-reeve

Maybe we can add letter.lowercase and letter.uppercase Thanks for suggestion! 👍

didavid61202 avatar Jul 30 '22 07:07 didavid61202

Hey 👋,

I'm interested in working on this! I'm not too sure how to approach the API design, however.

@didavid61202, are you suggesting that letter becomes:

const letter: Input<"[a-zA-Z]", never, []> & {
    lowercase: Input<"[a-z]", never, []>,
    uppercase: Input<"[A-Z]", never, []>,
}

?

Otherwise, we could expand the API to include standalone lowercase and uppercase Inputs...

 export const whitespace = createInput('\\s')
 export const letter = createInput('[a-zA-Z]')
+export const lowercase = createInput('[a-z]')
+export const uppercase = createInput('[A-Z]')
 export const tab = createInput('\\t')

I'd like to get it done as part of the Hacktoberfest event, so... as soon as we've settled on an API, I'm raring to get started!

ccjmne avatar Oct 24 '22 18:10 ccjmne

Yes, I think that the first option was what @didavid61202 was suggesting, and makes sense.

Also very happy to include other constructed inputs alongside letter/tab, but lower/upper-case makes sense to access within dot notation.

danielroe avatar Oct 25 '22 05:10 danielroe