multi language validation in javascript using validate.js [duplicate] - javascript

This question already has answers here:
jQuery validation in different languages
(3 answers)
Closed 7 years ago.
i work on project which contain English and Chinese language but i can't figure out how can i validation with validate.js in Chinese language.
from surfing i found one link which give these type facilities but unfortunate this link not working please give me reference or hint
https://github.com/chilijung/validate.js
thanks in advance

You may custom your own method.
http://jqueryvalidation.org/jQuery.validator.addMethod/
So you may use Regalur Expression to validate Chinese and English.
How to validate both Chinese (unicode) and English name?

Related

How to convert PHP Regex to jQuery Regex [duplicate]

This question already has answers here:
Match only unicode letters
(3 answers)
Closed 4 years ago.
I have this PHP regex:
/^[\p{L}\p{M}]+[\p{L}\p{M}\-\s]*$/u
and I want to convert it to jQuery. I tried multiple solutions that I found online, but nothing really worked. I tried using
new RegExp("/^[\p{L}\p{M}]+[\p{L}\p{M}\-\s]*$/u");
but that didn't help.
This is because \p{L} and \p{M} don't exist in the JavaScript RegEx engine. This answer provides solutions for matching Unicode categories: https://stackoverflow.com/a/26659285/1920035

Javascript Regex get each matching [duplicate]

This question already has answers here:
How can I match multiple occurrences with a regex in JavaScript similar to PHP's preg_match_all()?
(15 answers)
Closed 6 years ago.
I want to find each youtube link in a page. I found on StackOverflow some regex i modified but when i have a html code with two youtube linq the result is one match like
youtube.com?v=videoid<div></div>youtube.com?v=videoid2
I want to get each youtube link only.
My regex is :
/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([\w|-|_]{11})/
Can someone help me please?
Thanks and sorry for bad english.
try to add 'g' modifier at the end of the regular expression like so:
/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([\w|-|_]{11})/g
That means globally (get all matches)

What's the best regex to validate names? [duplicate]

This question already has answers here:
Regular expression for first and last name
(28 answers)
Regex for names
(27 answers)
Closed 8 years ago.
I'm creating a web store and I need to validate inputs with JavaScripts so the user doesn't have to submit a form to be given the PHP errors (although I'm also validating the form with PHP).
What I came up with is the following regex:
/^[a-zA-Z]+$/
But the above regex would only allow alpha characters whereas I also want to allow characters such as ' and - since obviously names may also contain these two characters. My question is, how to make a regex to allow alpha characaters AND the two characters above.
Besides that I also have one more question which just came in my mind, characters such as ă will pass the above validation ?
By adding them to your character group like so
/^[a-zA-Z'-]+$/

Email validation using javascript [duplicate]

This question already has answers here:
How can I validate an email address using a regular expression?
(79 answers)
Closed 9 years ago.
I am using
/^[a-zA-Z0-9\-_]+(\.[a-zA-Z0-9\-_]+)*#[a-z0-9]+(\-[a-z0-9]+)*(\.[a-z0-9]+(\-[a-z0-9]+)*)*\.[a-z]{2,4}$/
to validate my email IDs , but it has some issues like it is allowing below type mail ID which are invalid.
EX:
1. 1234#1234.com
2. 12deepak#abc.com
3. _deepak#abc.com
I have tried a lot by modifying the regular expression but not succeeded.
Any one please suggest me a correct regular expression ?
Try using
/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))#((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))$/i
Source: jQuery validation plugin

Facebook tag (fb:...) [duplicate]

This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
Create similar to fb:tag
In addition to my question:
Create similar to fb:tag
I would like to ask if someone knows how did Facebook create fb:tags using xmlns.
Just technologies and some short explanation.
I might find the answers that I am looking for the other question as well!
xmlns is used just to make html valid xhtml, the functionality wont work just by adding fb:.. imported javascript is the on which process these tags

Categories

Resources