How to Use Type-Ins Effectively

+39

On JetPunk, we have what's called type-ins. These use regular expressions to pattern-match what the user has entered into the text box against set expressions. For example, the expression might simply mean "type DOG exactly", so the user would have to type in the word "dog".

At this point it would be good to mention that JetPunk is not case sensitive, meaning that "AlpHa" is considered the same as "aLPHa". This is useful since we don't have to distinguish between capital letters and lowercase.

When creating type-ins, for many answers an automatic type-in will be loaded by default. This is mainly for common answers like Countries, Cities or States, though there are many others on there also. If it is not one of these common answers, then JetPunk will simply suggest a type-in base on the letters, such as a "y" at the end of a word will have the type-in "(EE|EY|IE|Y)" suggested. We'll go through what that means later.

Simple Type-Ins

There are many simple ways to add type-ins to JetPunk answers. For each answer, you are presented with three options: "Auto", "Custom" or "Exact".

  • Auto will use the automatic type-in if available or the suggested type-in otherwise.
  • Custom allows you to add your own type-ins.
  • Exact requires the exact word to be inputted, with no suggested type-ins applied.

Since the other two have no customisations, only Custom is worth discussing in detail. When selecting Custom, you'll notice 4 options appear at the bottom of the box:

  • + Starts - this is the default option, it allows you to decide what the user must start answers with when typing in. E.g. setting this to "CHINA" means that the user must start their answer with the text "china" to be accepted as an answer.
  • + Ends - this is similar to above, except this requires to ending of the typed guess to be something specific. E.g. setting this to "EVEREST" means that the user's guess ends with that, so "everest" and "mounteverest" would both be accepted.
  • + Contains - this options allows you to accept guesses containing a specific string of characters. A commmon example of this is "CONGO", which will accept any answer which contains the word "congo" in it somewhere.
  • + Regex - this allows the full customisation, it is discussed in complete detail below.

Overall, getting started with type-ins is pretty easy, but actually making type-ins which match against many possible guesses is more useful. For example, you'll never be able to add every possible misspelling of Kyrgyzstan using the first 3 above, for that we need some more powerful tools.

Type-Ins using RegEx

RegEx is short for Regular Expression and refers to a near-universal tool in programming that allows you to pattern match text against cases. We will use a simplified version, since many of the features of RegEx are not useful or available on JetPunk. For example there are characters used to pattern-match on some symbols, but this is useless since the answer-box on JetPunk accepts only alphanumeric input (letters and numbers).

There are 4 different "tokens" that are useful to us:

  • Character Classes
  • Anchors
  • Quantifiers and Alternation
  • Capturing Groups

We will go through what each one does, with examples, and then combine them together at the end.

Character Classes

Character Classes define a set of characters to be matched against. These are defined using square brackets [ ]. On their own, they will only match against one letter at a time within the letters between the brackets, called the class.

Examples:
  • [ABC] - this alone will match any answer which contains an A, B or a C
  • F[OEU]D - this will only match when FOD, FED or FUD is entered, since [OEU] only matches against one character (we'll see later with Quantifiers how to increase this)
  • [A-G] - you can also use a dash inside to allow it pattern match against any letter between A and G
  • [0-7] - this ranging feature also works with numbers
  • [AE][FG] - these character classes can be placed next to each other too, this will match when AF, AG, EF or EG is entered

Anchors

Anchors are used to define where we should match against. There are technically 3 anchors that we use:

  • ^ - this at the start of a type-in to signify that we want our answer to "Start with" whatever we want
  • $ - this goes at the end of a type-in to signify that we want our answer to "End with" whatever we want
  • Although this last one is a bit weird, it's actually the absence of ^ and $, which means we want our answer to "Contain" whatever we wish.

You'll notice these 3 options line up with the JetPunk options mentioned above in the Simple Type-Ins section. The downside to using those 3 options is that you can't use any other Regex within them, only plain letters and numbers.

Examples:
  • ^FOOD - this means we want our answer to start with "FOOD", this is the normal type-in for answers, since it's just matching against you typing in the answer
  • ING$ - this will activate whenever anything typed into the text box ends with "ING", e.g. "ing", "thing" or even "abfgvsbfoanfubding"
  • INSIDE - this will match any answer which contains the word INSIDE, e.g. "inside" or "whatinsideme" although the second you wouldn't be able to type in 'me' since it will activate the answer against "whatinside"
  • ^A[CLN]T - this matches against any answer starting with "act", "alt" or "ant"

I think this gives you an idea of where you could go. It's easy to see that using a ^ and $ in the same answer would be rather pointless in JetPunk's case.

Quantifiers and Alternation

There are 3 main tokens here which are useful for JetPunk and one additional one which is possible to use, but I can't see a use for it particularly.

  • + - the plus symbol matches against 1 or more of the preceding token (can be characters or most other tokens)
  • ? - the question mark is, suitably, used to match against 0 or 1 of the preceding token. Particularly used to denote optional characters in a type-in
  • | - this is the vertical line character called alternation. This acts like a boolean OR operation, meaning it will match the expression before or after the |. It can act on a single group, or on a whole expression

The extra one is *, which matches against 0 or more of the preceding token. Which is plausible to use, but as I mentioned I can't think of a practical use for it.

Examples:
  • ^FO+D - this means we start with "fo" and then can have any number of o's in the middle, e.g. "fod", "food" and "fooooood" all work
  • ^PHILIPP?INES - the original type-in for the Philippines, which allows you to type either 1 or 2 P's, since the second P is optional
  • ^MYANMAR|^BURMA - this is using an alternation on the whole expression, and will match an answer when it starts with either "myanmar" or "burma", this is particularly useful for "by borders" quizzes when you run out of type-in boxes (maximum of 10 are allowed)
  • ^MAI?N+E - this has an optional "I" and allows 1+ "N"s, so "mane", "maine" and "mainnnnne" will all activate this type-in
  • J[OU]+LE - this is a particularly useful combination, since this will allow the token "[OU]" as a whole 1+ times, meaning for this we can match against "JOLE", "JULE", "JOULE" or even "JOUUOUOUOULE"! This comes in handy when you have hard-to-spell words which users may need help with (see next example)
  • ^K[IY]RG[A-Z]+STAN - the famous type-in for Kyrgyzstan! This allows any word which starts with K, is followed by an 'I' or 'Y', then an "RG", then the fun bit - any number of letters of the alphabet (at least one) - then finally a "STAN". This means that "KYRGASTAN" and "KIRGVDAUIHDUGAVUDYIHAGDVSTAN" both activate a Kyrgyzstan answer on JetPunk. CAUTION: This "[A-Z]+" combination should be used sparingly, otherwise it may end up accepting answers you did not want it to

Some combinations are not valid, such as ?+ since this logically does not make sense, also +? is valid, but does nothing different to + anyway.

An example of that star token mentioned would be ^MI*NE which allows matches such as "MNE", "MINE" and "MIIIIIINE", since these all contain 0+ I's in the middle. Again this can be done in JetPunk, but I've yet to find a practical example for it.

Capturing Groups

Lastly, capturing groups utilise normal parentheses ( ) to group characters or tokens together. This means you can apply all the previous tools to create any type-in you wish now.

Examples:
  • ^M(OU|UO)LD - this uses an alternation to match against "ou" OR "uo", so "mould" and "muold" are both accepted. These are used in abundance of type-ins to provide alternative spellings, especially with words ending in "LY"
  • ^MAD(MAN)?ME - this uses an optional on an entire capture group, meaning that only answers starting with "madme" and "madmanme" are accepted here
  • ^J[AEIOU]T+PUN?K - getting a little more complex here, now allowing the second character to be any vowel, as well as then allowing 1+ T's afterwards and an optional on N. So "jetpunk", "jutttpuk" and "jatpuk" are all valid for this type-in
  • ^(SAINT|ST)?H[AE]R+[AEIOL]+S+[EO]N - this looks rather complex, so let's break it down into parts:
    • ^(SAINT|ST)? - this is a particularly useful combination for answer which may or may not have a prefix, this will accept any answer that start with "saint" OR "st", or it will accept if this is ignored entirely too thanks to the optional outside the capture group.
    • H[AE]R+ - this part requires a "h" followed be a single "a" or "e", then followed by at least one "r".
    • [AEIOL]+S+[EO]N - this final part takes at least one letter from "A", "E", "I", "O", "L" (i.e. can be any number of these in combination, as long as there's at least one of one of them), followed by 1+ S's, then a single E or O and finally an N.

Possible matches to that last example are "harasen", "st heroileaoson" or perhaps "saint harrrrrroioieoloieaesssssen".

As you can see, in combination these can be very powerful tools which can provide very useful type-ins for for quiz-makers and quiz-takers.

What's the point?

The point of type-ins is to provide an easier way to match against possible user answers. Yes, it's possible to just type every possible spelling somebody may input as the answer, but what if you miss somebody's way of misspelling? And why do that when we can simplify them?

If we go back to our example of Kyrgyzstan:

^K[IY]RG[A-Z]+STAN

This type-in does wonders since nearly everybody spells Kyrgyzstan incorrectly in a different way at some point. This type-in was made by stripping it back to what it needs to be the word Kyrgyzstan, which means it needs to start with K, then either I or Y followed by RG. We also want it to end with STAN, which all gets combined to produce the type-in shown above.

Finally, many users appreciate when a quizmaker puts effort into type-ins, since this makes it a more pleasant quiz to take, especially when some of the answers come from other languages or can be simply strange in spelling or formation.

Also, if you'd like to explore RegEx further outside of JetPunk to practice or otherwise, RegExr is an excellent tool for getting to grips with all the terminology and features. It is also useful for testing the more complicated type-ins!

+18
Level 82
Jul 4, 2019
Very clear. Thanks!
+18
Level 75
Jul 4, 2019
Very educational. Thanks!
+15
Level 68
Jul 5, 2019
What a great blog, should of commented earlier :P
+10
Level 28
Jul 7, 2019
Learned a lot from this. thanks
+21
Level 72
Apr 15, 2020
I'm going to start typing 'kyrgkqhbhjfbahbnaaqnmstan' now thanks!
+1
Level 65
Apr 13, 2021
Same! KIRGVDAUIHDUGAVUDYIHAGDVSTAN
+1
Level 53
Oct 15, 2020
what about for an by clue quiz
+2
Level 59
Dec 7, 2020
What should I do for a quiz with many correct answers for one question? You can only have up to ten regexes I'm pretty sure.
+4
Level 68
Dec 7, 2020
You can have ten lines, correct, but you can combine regex into a single line, see the myanmar / burma combination in the blog above. Simply put | (vertical line) between each regex, ensuring you have ^ (meaning starts with) each time!
+3
Level 60
Mar 31, 2021
Omg thank you. Im trying to make a category elimination quiz and that helps so much
+1
Level 33
Jan 11, 2021
How do you make it so one of the answers are already there
+5
Level 68
Jan 11, 2021
If you mean a "fill in the blank" like lyrics quizzes, this can be done by surrounding text you want to be visible always by { } in Step 2. For example, doing "{Jet}Punk is {the} best" in Step 2 would show "___Punk is ___ best" and the typeins would automatically change to "JETBEST"
+1
Level 33
Jan 26, 2021
No

I mean when you do a country quiz and its on Europe and you want Cyprus or Azerbaijan already there so no one complains

+2
Level 57
Apr 25, 2021
See Stewart's reply to @anonimous down below
+1
Level 60
Jun 15, 2023
*The typeins would be "JETTHE"
+1
Level 57
Feb 3, 2021
How do you do so an answer appears automatically when one opens the quiz (Example: Answers to avoid confusion)?
+2
Level 68
Feb 3, 2021
If you mean like the Congos on the "countries starting C" quiz, you don't want these in Step 2. Step 2 is only for answers that should be typed. All others can be added in Step 4.

Simply switch the design mode in step 4 to "manual", and then options to add rows and columns to each block appear, so you can add a new row, type in the pre-filled answer, and then style that row / cell however you'd like (e.g. fill it grey).

+1
Level 61
Feb 5, 2021
Technically, Philippines is the country's actual name

[I would know, I was born there ;)]

+1
Level 23
Mar 4, 2021
Thanks a lot for these instructions!

It was very useful for me ^^

+1
Level 40
Mar 20, 2021
thank you! but what if i want to make a ''how many times can you type'' quiz?
+2
Level 57
Mar 29, 2021
use the yellow box (the option to do this is in step 1)
+1
Level 60
Mar 31, 2021
You can use the * for abbreviations like DRC
+2
Level 59
Dec 4, 2022
Well, you can also do (Democratic Republic of the Congo|DRC).

Therefore * still doesn't have a use.

+1
Level 59
Dec 20, 2022
Your solution also allows for "DEEEEEEEEEEMMMMMMM orc" being accepted and is just a harder type in to make.
+3
Level 43
Jan 18, 2022
how to do it if the answer consists of 2+ words in ANY order?

Like if to accept both "mad cow" and "cow mad".

Is (COWMAD|MADCOW) the only option?

+2
Level 68
Jan 18, 2022
Yes, unfortunately this is the only option if you want both to be typed.
+1
Level 24
Mar 27, 2022
Now I can make quizzes with 10+ Type-ins!
+1
Level 30
May 5, 2022
I'm trying to make a quiz, which uses regex. My first thing is:

word that starts with n

When I try to do that, just typing n enters it in correctly. How do I fix it?

+3
Level 68
May 5, 2022
the only way to prevent that is to force other characters to be typed. For example, if you want "5 letter word starting with n" you could do:

^N[A-Z][A-Z][A-Z][A-Z]

However, this would allow "NNNNN" as a word, which may not be what you want.

+2
Level 59
Dec 4, 2022
While * is pretty useless (I do like to use it to allow people to have ? but with more letters), there is something I think is a bit funny you can do with it.

Normally you can't get an answer by just putting a space. However if you put * after every letter in your answer, once the quiztaker puts a space (just " ") it will fill in the answer. I've only done this on a preview, I don't know if this works on the real quiz.

+3
Level 68
Dec 4, 2022
Technically yes, because it would then be looking for "nothing", but you still need to type a key to trigger it. So even hitting "enter" or "backspace" should trigger it too!
+1
Level 59
Dec 20, 2022
I've finally found an actual use! Making a quiz on the Hyderabad Metro.

The answer is Road No. 5, Jubilee Hills (The source has it this way, so this is how it will show up).

I want Road No. 5 to work. I also want Road 5 to work. I also want Road Number 5 to work.

I ended up doing ^ROAD[A-Z]*(FIVE|5)

I am allowing someone to put anything between road and 5.

Using ? would mean they are limited to 2 letters, not allowing them to do Road Number 5. Using + Means they MUST put a letter there.

* is the solution!

+4
Level 68
Dec 20, 2022
In this case I would have chosen

^ROAD(NO|NUMBER)?(FIVE|5)

Since this prevents many variations being allowed

+1
Level 59
Dec 20, 2022
Just thought of that lol. However, this is more lenient and accounts for the 1 person who misspells number.

It's also technically faster to write.

Your solution is perfectly plausible. I'm going to keep my solution though since I think it makes the quiztaking experience easier. I don't know what variations someone would even try that would trigger this.

I think it could be useful in a case where there are many optional words in the middle of a type in.

+2
Level 68
Dec 20, 2022
Yes I suppose that makes sense. I also thought an English word which sometimes has 0 1 or 2 of the same letter might work, instead of doubling up on ?? But I can't think of an example.
+1
Level 59
Dec 20, 2022
I think it's more likely it would be used in a translated proper noun (such as a foreign city). They are more often ambiguous in spelling, and would need *.

If that makes sense.

+2
Level 41
Jan 22, 2023
Hey Stewart

Im Having Problems. How do i make a quiz with many answers to one question? Im trying to make one, but i can add that many type ins. So Help Pls.

Thank You

+3
Level 68
Jan 23, 2023
Either instead of adding typeins in Step 3, add the answers separated by a slash. E.g. Alpha / Beta / Gamma. This will separate their typeins in Step 3.

Alternatively, you can put more than 1 typein in a specific line. If you add a regex line, you can add multiple typeins using |. E.g. ^Alpha|^Beta|^Gamma

+1
Level 41
Jan 23, 2023
Thank you Stewart!
+1
Level 41
Jan 23, 2023
One Last question.

Ok Say I wanted to make a quiz that is country by letter but there is none by that letter. How do i make it show up that there is none?

+3
Level 68
Jan 23, 2023
In Step 4, towards the top, switch to "Manual" design mode. Then options will appear on the right hand side to add / remove rows. You can add a row, and then type in text directly in Step 4. This will always be visible. Then, for example, you could style that row to have a grey background similar to some other quizzes (like A-Z quizzes).
+1
Level 15
Mar 24, 2023
how do you make it so that you have to click on the exact 1 like if there are 2 and's but you only want 1 at a time? like on some of the quizzes, there's a yellow box around the question. how do you get that when making a quiz?
+1
Level 68
Mar 24, 2023
Yellow boxes can be enabled on the right-hand (or the top on mobile, under the gear) by selecting the option "Yellow Box" to "Yes".
+2
Level 15
Mar 24, 2023
right hand on what step
+2
Level 68
Mar 24, 2023
oh sorry, it's under Step 1 and it is only on Text and Picture Quizzes
+1
Level 43
Jun 14, 2023
I don't think this goes under the category "Type-ins", but how do you put a link in a Jetpunk quiz? Like if you were trying to link it to others in the series or something? Thanks
+2
Level 68
Jun 14, 2023
Well, JetPunk itself has a quiz series functionality anyway. You can edit this in the "create quiz index". The series then appears on the right hand side of the page (or at the bottom on mobile).

To add a link to another page / website etc... Simply use the following HTML, removing the space after the "<":

< a href="URL">TEXT< /a>

Replacing URL and TEXT with whatever you want the link to say and go to.

+1
Level 60
Jun 26, 2023
How do lone parenthesis work?

If there is a * present, parenthesis serve as square brackets. (PA)*L accepts L, AAL, and PAPAL.

If a + present, the inside information can be repeated. (PA)+L accepts PAPAL and PAL, but not AAL.

Otherwise, they are ignored. (PA)L only accepts PAL.

However, if there is a hyphen when there is no + or * like (A-Z)STAN, there doesn't seem to be any text that works. How does that function?

+2
Level 68
Jun 26, 2023
Well in this case the regex is looking for the string "A-Z", but since all punctuation and spaces are stripped from JetPunk input, it can never be matched against.

Parentheses are just subsets of input data used to separate sections of the regex.

Square brackets however are character classes and have special functions to allow them to have different behaviours. E.g. - for character ranges, [^d] for negation etc...

+1
Level 60
Jun 26, 2023
Okay, thanks.
+1
Level 79
Jul 24, 2023
I take it there's no way to add an answer/picture that doesn't need to be typed in a picture quiz?
+1
Level 45
Aug 18, 2023
I am trying to add a lot of type ins for an answer but the max number is 10. Then it won't let me add more.
+1
Level 63
Dec 16, 2023
Use ( | | ) and put different typeins in each one
+1
Level 59
Nov 24, 2023
Ok use for *!!!:

My source says 8 in hindi is Aaath. Another says Aath, I also want Ath to be accepted. So ^AA*T (i also allow the omission of the h. So is this finally a use for *!!?!?!?

+2
Level 63
Dec 16, 2023
A+TH?
+1
Level 34
Jan 15, 2024
hey, (ik this is unrelated,but) how do you change the url of your quiz?
+1
Level 68
Jan 15, 2024
You can't, unfortunately
+1
Level 40
Jan 21, 2024
I am trying to create a multiple answer quiz but it doesn't let me use symbols like | and [], they automatically delete after i type them in the type ins. Why is that?
+1
Level 68
Jan 21, 2024
You likely need to select the "Regex" option and not the default "Starts With".
+1
Level 34
Feb 12, 2024
Hallo! Ich hätte zwei Fragen:

- Wie kann ich bei einem Quiz bei manchen „Hints“ zwei Antwortmöglichkeiten, die jedoch beide genannt werden müssen, bei anderen jedoch nur eine einstellen?

- Wie kann ich es einstellen, dass „Hints“ nacheinander beantwortet werden müssen und gleichzeitig nicht andere „Hints“ beantwortet werden, welche den gleichen Begriff als Antwort haben?

+1
Level 43
Feb 13, 2024
I want to have two consecutive columns as answers, but only one is highlighted yellow as an "answer" column. How would I change this?
+1
Level 68
Feb 13, 2024
To have multiple answer columns, you have to play with the Manual grid options.

First, you can only have a single answer column in Step 2, so you must put all answers separately in this area.

In Step 4, you can enable "Manual" design mode at the top of the page, and on the right-hand side will appear several options for adding/removing rows, columns and blocks (like whole groups of columns).

This will allow you to add cells to whatever design you wish. Afterwards, select a cell and choose an answer or hint using the "Manual Cell Options" at the top of the page.