JavaScript RegExp [0-9] Expression

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP







<!--
main_leaderboard, all: [728,90][970,90][320,50][468,60]
-->



JavaScript RegExp [0-9] Expression


❮ JavaScript RegExp Object




Example


Do a global search for the numbers 1, 2, 3 and 4 in a string:



var str = "123456789";

var patt1 = /[1-4]/g;

<!--

The marked text below shows where the expression gets a match:



123456789
-->
Try it Yourself »


Definition and Usage


The [0-9] expression is used to find any character between the brackets.


The digits inside the brackets can be any numbers or span of numbers from 0 to 9.


Tip: Use the [^0-9] expression to find any
character that is NOT a digit.



Browser Support















Expression
[0-9] Yes Yes Yes Yes Yes


Syntax



new RegExp("[0-9]")


or simply:


/[0-9]/


Syntax with modifiers




new RegExp("[0-9]", "g")


or simply:


/[0-9]/g



More Examples



Example


Do a global search for the number "1" in a string:



var str = "12121212";

var patt1 = /[1]/g;

<!--

The marked text below shows where the expression gets a match:



12121212
-->
Try it Yourself »




❮ JavaScript RegExp Object

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

PHP code is not being executed, instead code shows on the page

Malaysia to Papua New Guinea by motorcycle?