Reputation: 21
Simple question...
I am trying to make this regex work with C functions regcomp
/regexec
. It does not.
(?=.*\d.*)(?=.*[a-zA-Z].*).{6,10}
Two questions:
What does:
?=.*
mean? Could you please break this down in simple terms?
Why doesn't this work with regcomp().
I know your inclination is to tell me what a fool I am, and how dare me come in here and ask such a question. Google it you _. Thanks, okay I am an idiot, I know. Okay. Ha ha the joke is on me and I am public about my silly newbie questions.
BTW I am well aware of the fact that regex syntax is different from one system to another. That is my frustration with this.
Upvotes: 1
Views: 389
Reputation: 3446
1: (?= ... )
is a lookahead. It checks to see if the RegEx inside is found behind your string. In this case, it is checking if your string contains at least a digit and any case character; also the entire string should be between 6 and 10 characters in length.
Also, it's not working because it needs to be: (?=.*\d)(?=.*[a-zA-Z])^.{6,8}$
.
Upvotes: 1