SlideShare una empresa de Scribd logo
1 de 14
12 Different
Regular Expression for
Integer Number
Tip #1

http://www.youtube.com/zarigatongy
Most Usefull Regex By Examples
1.
2.
3.
4.
5.

Regex Number with Range
Regex Allow Only Number
Regex Number Range
Regex Signed Integer
Regex Comma as the thousand separator and the dot as the
decimal separator
6. Regex Five Integer US ZIP Code
7. Regex Positive Integer
8. Regex non zero positive integer
9. Regex Integer with 1000s Separator
10. Regex Hexadecimal Numbers
11. Regex Hexadecimal Number with Range
12. Regex Binary Number
http://www.youtube.com/zarigatongy
• Five Integer US ZIP Code
^d{5}$

• Matches 33333 | 55555 | 23445
• Non-Matches abcd | 1324 | as;lkjdf

http://www.youtube.com/zarigatongy
Positive Integer
^d+$
• Matches 123 | 10 | 54
• Non-Matches -54 | 54.234 | abc

http://www.youtube.com/zarigatongy
• Non zero positive integer
^(0+[1-9]|[1-9])[0-9]*$
• Matches 122, 9992, 000022
• Non-Matches 0, 00000, 1.2, -3.22

http://www.youtube.com/zarigatongy
• Integer with 1000s Separator
^[1-9]{1}[0-9]{0,2}([.,]?[0-9]{3})*$
• Matches 1,000|1.000|1|10|100|1000
• Non-Matches 1,00|1,0|1,,000|.1|10.

http://www.youtube.com/zarigatongy
• Hexadecimal Numbers,
0[xX][0-9a-fA-F]+

e.g.
‘0x0f4’, ‘0acdadecf822eeff32aca5830e438cb54a
a722e3’, ‘8BADF00D’

http://www.youtube.com/zarigatongy
Allow a string to only contain numbers 0 - 9 and
limit length to 50
^[0-9]{1,50}$
– Matches 00303039
– Non Matches 039330a29

http://www.youtube.com/zarigatongy
1. Allow Only Number
– A[0-9]+Z
– ^[0-9]+$

http://www.youtube.com/zarigatongy
• Regex Number Range
a. 000..255: ^([01][0-9][0-9]|2[0-4][0-9]|25[0-5])$
b. 0 or 000..255: ^([01]?[0-9]?[0-9]|2[0-4][0-9]|25[05])$
c. 0 or 000..127: ^(0?[0-9]?[0-9]|1[01][0-9]|12[0-7])$
d. 0..999: ^([0-9]|[1-9][0-9]|[1-9][0-9][0-9])$
e. 000..999: ^[0-9]{3}$
f. 0 or 000..999: ^[0-9]{1,3}$
g. 1..999: ^([1-9]|[1-9][0-9]|[1-9][0-9][0-9])$
h. 001..999: ^(00[1-9]|0[1-9][0-9]|[1-9][0-9][0-9])$
i. 1 or 001..999: ^(0{0,2}[1-9]|0?[1-9][0-9]|[1-9][09][0-9])$
j. 0 or 00..59: ^[0-5]?[0-9]$
k. 0 or 000..366: ^(0?[0-9]?[0-9]|[1-2][0-9][0-9]|3[05][0-9]|36[0-6])$
http://www.youtube.com/zarigatongy
• Integer decimal number with an optional plus
or minus sign
[+-]?b[0-9]+b

http://www.youtube.com/zarigatongy
• comma as the thousand separator and the dot
as the decimal separator
^[0-9]{1,3}(,[0-9]{3})*.[0-9]+$

http://www.youtube.com/zarigatongy
• Hexadecimal Number With Range
• 0 to FFFF
^([1-9a-f][0-9a-f]{1,3}|[0-9a-f])$
• 1 to 366
^(16[0-9a-e]|1[0-5][0-9a-f]|[1-9a-f][0-9a-f]?)$
• 0 to 255
^[1-9a-f]?[0-9a-f]$
• ASCII codes
^(7[0-9a-e]|[2-6][0-9a-f])$

http://www.youtube.com/zarigatongy
More Protocol Tutorials
•
•
•
•
•
•
•
•

SSL Protocol Click here
DHCPv6 Protocol Click Here
CHAP Protocol Click Here
ISCSI Protocol Tutorial Click Here
BGP Tutorial Click Here
RADIUS Protocol Click Here
PPP Protocol Click Here
PPPoE Protocol Click Here
http://youtube.com/zarigatongy

Más contenido relacionado

Destacado

The Point to Point Protocol (PPP)
The Point to Point Protocol (PPP)The Point to Point Protocol (PPP)
The Point to Point Protocol (PPP)zarigatongy
 
RADIUS- Packet Example/Vendors
RADIUS- Packet Example/Vendors RADIUS- Packet Example/Vendors
RADIUS- Packet Example/Vendors zarigatongy
 
Top 10 programming langauges crossed decades
Top 10 programming langauges crossed decadesTop 10 programming langauges crossed decades
Top 10 programming langauges crossed decadeszarigatongy
 
Password Authentication Protocol
Password Authentication ProtocolPassword Authentication Protocol
Password Authentication Protocol zarigatongy
 
Listado iv valida x club
Listado iv valida x clubListado iv valida x club
Listado iv valida x clubHenry Duran
 
C.S. - Capítulo 09 se enciende una luz en suiza
C.S. - Capítulo 09  se enciende una luz en suizaC.S. - Capítulo 09  se enciende una luz en suiza
C.S. - Capítulo 09 se enciende una luz en suizaDescargas Adventista
 
PNG "Subir ao Topo"
PNG "Subir ao Topo"PNG "Subir ao Topo"
PNG "Subir ao Topo"Aline Fraga
 
Noemi machado deber
Noemi machado deberNoemi machado deber
Noemi machado deberNoemi2050
 
699- St llorenç de Morunys
699- St llorenç de Morunys699- St llorenç de Morunys
699- St llorenç de Morunysmireille 30100
 
Otimização de Conversão - CRO - Mkt na Veia
Otimização de Conversão - CRO - Mkt na VeiaOtimização de Conversão - CRO - Mkt na Veia
Otimização de Conversão - CRO - Mkt na VeiaAristonSimon
 
AATECH LED Catalogue 2015
AATECH LED Catalogue 2015AATECH LED Catalogue 2015
AATECH LED Catalogue 2015Miya Lee
 
Apresentação - Marketing Digital, O que é isso Afinal
Apresentação - Marketing Digital, O que é isso AfinalApresentação - Marketing Digital, O que é isso Afinal
Apresentação - Marketing Digital, O que é isso AfinalAristonSimon
 

Destacado (17)

The Point to Point Protocol (PPP)
The Point to Point Protocol (PPP)The Point to Point Protocol (PPP)
The Point to Point Protocol (PPP)
 
RADIUS- Packet Example/Vendors
RADIUS- Packet Example/Vendors RADIUS- Packet Example/Vendors
RADIUS- Packet Example/Vendors
 
Top 10 programming langauges crossed decades
Top 10 programming langauges crossed decadesTop 10 programming langauges crossed decades
Top 10 programming langauges crossed decades
 
Password Authentication Protocol
Password Authentication ProtocolPassword Authentication Protocol
Password Authentication Protocol
 
Mudanças itil
Mudanças itilMudanças itil
Mudanças itil
 
Listado iv valida x club
Listado iv valida x clubListado iv valida x club
Listado iv valida x club
 
C.S. - Capítulo 09 se enciende una luz en suiza
C.S. - Capítulo 09  se enciende una luz en suizaC.S. - Capítulo 09  se enciende una luz en suiza
C.S. - Capítulo 09 se enciende una luz en suiza
 
Trabajo ultimo
Trabajo ultimoTrabajo ultimo
Trabajo ultimo
 
PNG "Subir ao Topo"
PNG "Subir ao Topo"PNG "Subir ao Topo"
PNG "Subir ao Topo"
 
About Us -
About Us -About Us -
About Us -
 
Wikis 1
Wikis 1Wikis 1
Wikis 1
 
Noemi machado deber
Noemi machado deberNoemi machado deber
Noemi machado deber
 
Wilmari guevara_Economia
Wilmari guevara_EconomiaWilmari guevara_Economia
Wilmari guevara_Economia
 
699- St llorenç de Morunys
699- St llorenç de Morunys699- St llorenç de Morunys
699- St llorenç de Morunys
 
Otimização de Conversão - CRO - Mkt na Veia
Otimização de Conversão - CRO - Mkt na VeiaOtimização de Conversão - CRO - Mkt na Veia
Otimização de Conversão - CRO - Mkt na Veia
 
AATECH LED Catalogue 2015
AATECH LED Catalogue 2015AATECH LED Catalogue 2015
AATECH LED Catalogue 2015
 
Apresentação - Marketing Digital, O que é isso Afinal
Apresentação - Marketing Digital, O que é isso AfinalApresentação - Marketing Digital, O que é isso Afinal
Apresentação - Marketing Digital, O que é isso Afinal
 

Último

week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptxJonalynLegaspi2
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1GloryAnnCastre1
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...DhatriParmar
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...Nguyen Thanh Tu Collection
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQuiz Club NITW
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 

Último (20)

week 1 cookery 8 fourth - quarter .pptx
week 1 cookery 8  fourth  -  quarter .pptxweek 1 cookery 8  fourth  -  quarter .pptx
week 1 cookery 8 fourth - quarter .pptx
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1Reading and Writing Skills 11 quarter 4 melc 1
Reading and Writing Skills 11 quarter 4 melc 1
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
Beauty Amidst the Bytes_ Unearthing Unexpected Advantages of the Digital Wast...
 
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
31 ĐỀ THI THỬ VÀO LỚP 10 - TIẾNG ANH - FORM MỚI 2025 - 40 CÂU HỎI - BÙI VĂN V...
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITWQ-Factor General Quiz-7th April 2024, Quiz Club NITW
Q-Factor General Quiz-7th April 2024, Quiz Club NITW
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 

Regular Expression

  • 1. 12 Different Regular Expression for Integer Number Tip #1 http://www.youtube.com/zarigatongy
  • 2. Most Usefull Regex By Examples 1. 2. 3. 4. 5. Regex Number with Range Regex Allow Only Number Regex Number Range Regex Signed Integer Regex Comma as the thousand separator and the dot as the decimal separator 6. Regex Five Integer US ZIP Code 7. Regex Positive Integer 8. Regex non zero positive integer 9. Regex Integer with 1000s Separator 10. Regex Hexadecimal Numbers 11. Regex Hexadecimal Number with Range 12. Regex Binary Number http://www.youtube.com/zarigatongy
  • 3. • Five Integer US ZIP Code ^d{5}$ • Matches 33333 | 55555 | 23445 • Non-Matches abcd | 1324 | as;lkjdf http://www.youtube.com/zarigatongy
  • 4. Positive Integer ^d+$ • Matches 123 | 10 | 54 • Non-Matches -54 | 54.234 | abc http://www.youtube.com/zarigatongy
  • 5. • Non zero positive integer ^(0+[1-9]|[1-9])[0-9]*$ • Matches 122, 9992, 000022 • Non-Matches 0, 00000, 1.2, -3.22 http://www.youtube.com/zarigatongy
  • 6. • Integer with 1000s Separator ^[1-9]{1}[0-9]{0,2}([.,]?[0-9]{3})*$ • Matches 1,000|1.000|1|10|100|1000 • Non-Matches 1,00|1,0|1,,000|.1|10. http://www.youtube.com/zarigatongy
  • 7. • Hexadecimal Numbers, 0[xX][0-9a-fA-F]+ e.g. ‘0x0f4’, ‘0acdadecf822eeff32aca5830e438cb54a a722e3’, ‘8BADF00D’ http://www.youtube.com/zarigatongy
  • 8. Allow a string to only contain numbers 0 - 9 and limit length to 50 ^[0-9]{1,50}$ – Matches 00303039 – Non Matches 039330a29 http://www.youtube.com/zarigatongy
  • 9. 1. Allow Only Number – A[0-9]+Z – ^[0-9]+$ http://www.youtube.com/zarigatongy
  • 10. • Regex Number Range a. 000..255: ^([01][0-9][0-9]|2[0-4][0-9]|25[0-5])$ b. 0 or 000..255: ^([01]?[0-9]?[0-9]|2[0-4][0-9]|25[05])$ c. 0 or 000..127: ^(0?[0-9]?[0-9]|1[01][0-9]|12[0-7])$ d. 0..999: ^([0-9]|[1-9][0-9]|[1-9][0-9][0-9])$ e. 000..999: ^[0-9]{3}$ f. 0 or 000..999: ^[0-9]{1,3}$ g. 1..999: ^([1-9]|[1-9][0-9]|[1-9][0-9][0-9])$ h. 001..999: ^(00[1-9]|0[1-9][0-9]|[1-9][0-9][0-9])$ i. 1 or 001..999: ^(0{0,2}[1-9]|0?[1-9][0-9]|[1-9][09][0-9])$ j. 0 or 00..59: ^[0-5]?[0-9]$ k. 0 or 000..366: ^(0?[0-9]?[0-9]|[1-2][0-9][0-9]|3[05][0-9]|36[0-6])$ http://www.youtube.com/zarigatongy
  • 11. • Integer decimal number with an optional plus or minus sign [+-]?b[0-9]+b http://www.youtube.com/zarigatongy
  • 12. • comma as the thousand separator and the dot as the decimal separator ^[0-9]{1,3}(,[0-9]{3})*.[0-9]+$ http://www.youtube.com/zarigatongy
  • 13. • Hexadecimal Number With Range • 0 to FFFF ^([1-9a-f][0-9a-f]{1,3}|[0-9a-f])$ • 1 to 366 ^(16[0-9a-e]|1[0-5][0-9a-f]|[1-9a-f][0-9a-f]?)$ • 0 to 255 ^[1-9a-f]?[0-9a-f]$ • ASCII codes ^(7[0-9a-e]|[2-6][0-9a-f])$ http://www.youtube.com/zarigatongy
  • 14. More Protocol Tutorials • • • • • • • • SSL Protocol Click here DHCPv6 Protocol Click Here CHAP Protocol Click Here ISCSI Protocol Tutorial Click Here BGP Tutorial Click Here RADIUS Protocol Click Here PPP Protocol Click Here PPPoE Protocol Click Here http://youtube.com/zarigatongy