How does jquery use regular

The method used by jquery regular: 1. User password, the code is [/^[a-zA-Z][a-zA-Z0-9_]{5,20}$/]; 2. Mail, the code is [/^ [\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/].



The operating environment of this tutorial: windows7 system, jquery 3.2.1 version, this method is applicable to all brand computers.

Recommendation: jquery video tutorial

jquery regular use method:

1. The creation of regular expression

a) var checkNum = /^[A-Za-z0-9]+$/;

b) var re=new RegExp("["+ s1+"]","g");

2. Common rules

a) User password: /^[a-zA-Z][a-zA-Z0-9_]{5,20}$/

b) Mail:/^ [\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/

c) mobile phone: /^[\d]{5, 20}$/

d) Other commonly used verification: please Baidu

3. Method: test

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55







    

    

    







    Username: Detection

    

    




    Mailbox: Detection

    

    




    Mobile phone: detection

    

    












Related free learning recommendations: javascript (video)

Guess you like

Origin blog.csdn.net/ld17822307870/article/details/112915210