Single number regex

Hello everyone
i’m trying to write a code where my only problem is to search for a specific number, single digit, without any repetition , and this number may or may not be there with make it more hard.
i tried : /^(1){1}\s/ , /[1]{1}\s/ , [1{1}]\s/ , /[1-1]\s/ , /\d{1}\s/ and tried all of them with {1,1} .
i would appreciate any help[]
this is my code,

What happens if you try,


Quantifiers - JavaScript | MDN

my proplem is that the number is not at the end ,it’s actually the first of few but i don’t know how search for a single one at the start .


The carat means ‘begins with’ as I recall.

i updated the post with a link ,pleas take a look if you have some time

How about,


syntax error ,nothing to repeat ,and that’s the case with many other attempts

What happens if you add a space character at the end.

1 Like

finaly ,it worked ,thank you very much ,i was going crazy over this :sweat_smile:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.