Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need one regex which validates below condition for password entered by user:
it must have at least one capital letter
it must have at least one number
It must have at least one special character
I need regex to implement it in javascript.
I have tried this one
/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!##$%^&*()_+|~-=\`{}[]:";'<>?,])/i;
Thanks in Advance
For the rules you mentioned:
/^(?=.*[0-9])(?=.*[A-Z])(?=.*[^a-zA-Z0-9])/;
This should suffice.
[^a-zA-Z0-9] matches anything that is not an alphabet and not a number, i.e. a special character.
I removed the case insensitive flag because you specifically mentioned there should be 1 uppercase letter.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
When entering the SSN on the webform, I need the digit to appear for a couple of seconds and then have it go to an asterisk.
Is this possible? Please provide directions.
you can try something which is suggested here:
http://css-tricks.com/better-password-inputs-iphone-style/
there are 2 examples, one flashes the last digit entered, while keeping the textbox as asterisk. other example keeps everything as asterisk except the last digit.
The trick to this is changing the input type from text to password in the input's change event, with a setTimeout if needed. See this fiddle for a simple example using jquery.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Regular Expression to validate the turkey phone number either in php or js
Example : +90 (212) 123 12 12
Try this : http://www.txt2re.com/index-javascript.php3?s=%2b90%20(212)%20123%2012%2012&28&17&22&18&23&19&24&27&20&25&21&26
I often use this site to do my regex. It generates code in the language you want.
Just edit what's inside the "if" once you copied the code. Magic.
try this, it should work in php environment
^\+(\d{2})\s\((\d{3})\)\s(\d{3})\s(\d{2})\s(\d{2})
DEMO
javascript...
var testNumber = "+90 (212) 123 12 12";
testNumber.replace(/\D+/g,"").matches(/90\d{10}/);
that eliminates all non digit chars and then makes sure that you have 90 followed by 10 digits
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I'm asking my users to write their domain name.
I'm looking for inputs of these types (=good):
http://www.Domain.com
http://Domain.com
https://www.Domain.com
https://Domain.com
www.Domain.com
Domain.com
http://no.matter.how.many.Domain.com
https://no.matter.how.many.Domain.com
no.matter.how.many.Domain.com
http://www.Domain.com/
https://www.Domain.com/
http://no.matter.how.many.Domain.com/
https://no.matter.how.many.Domain.com/
www.Domain.com/
Domain.com/
I'm want to reject any input that not in this format.
Bad inputs, for example:
http://www.Domain.com/page
http://www.Domain.com/page.html
http://www.Domain.com/page/page2
and so on...
Can you help me with a suitable RegEx?
Thank you!
You can use this regex
^(https?://)?[^/]+/?$
^depicts the start of string
$ depicts the end of string
? matches preceding group or char optionally..
Solution:
(https?://)?(www.)?([A-Za-z]+\.){1,}([A-Za-z]{2,})/?
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
i want to ignore all special character but "-" and non-english characters on key press in jquery. Actually this input is used to check domain availability. like;
www.________.com | for and end extensions are already provided for user. they won't enter those parts.
can you help?
You should use a onChange event, since users can also paste something into the field.
To check if the string is a valid url, use this pattern
var urlPattern = /(http|ftp|https):\/\/[\w-]+(\.[\w-]+)+([\w.,#?^=%&:\/~+#-]*[\w#?^=%&\/~+#-])?/
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to use JavaScript regexp replace text below:
i love #HTC & #HTC-One
to
i love #HTC & HTC-One
var result = "i love #HTC & #HTC-One".replace(
/#([\w-]+)/g,
'#$1');
The regex looks for words that start with # alpha numeric and -.
The word without the # is enclosed in parenthesis to make it a capturing group.
The capturing group is referenced in the replacement with $1