Help Regex

Experts Hello Dear,
I need help.
I am looking for an experiment that will allow reading in alphanumeric with the capital letter with space for example KESSE2 ANGE

Hi @ANGE_KESSE

https://docs.opendatakit.org/form-regex/ is a good primer

Once you have gone through it you can post specific questions

Try this:

regex(., '^[A-Z][a-zA-Z0-9]*[\ ]')

To decipher this cryptic regex expression:

^ asserts position at start of a line
Match a single character present in the list below [A-Z]
    A-Z a single character in the range between A (index 65) and Z (index 90) (case sensitive)
Match a single character present in the list below [a-zA-Z0-9]*
    * Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
    a-z a single character in the range between a (index 97) and z (index 122) (case sensitive)
    A-Z a single character in the range between A (index 65) and Z (index 90) (case sensitive)
    0-9 a single character in the range between 0 (index 48) and 9 (index 57) (case sensitive)
Match a single character present in the list below [\ ]
    '\ ' matches the character ' ' (ie space) literally (case sensitive)

or better yet, go to https://regex101.com/ and have a play yourself! :slight_smile:

Note, this regex only matches the first word in your example - you didn't indicate if multiple words are required and/or if these must follow the same rules as the first word. Also, you didn't indicate whether the word 'A' by itself is OK; if a word must be at least 2 characters long, replace the * with a +. [BTW escaping the final space isnt strictly required, but I like to make any 'special' characters more obvious]

1 Like

Thank for you answer