This question already has answers here:
Reference - What does this regex mean?
(1 answer)
Unicode code point escapes in regex literals - Javascript
(1 answer)
Does JavaScript support Unicode ranges above 0xFFFF in regular expressions?
(2 answers)
Closed 4 years ago.
I have encountered an issue when testing a char against a RegExp in JavaScript. The following line of code evaluates to true while it should evaluate to false.
/[\u10500-\u10D25]/.test('A');
Related
This question already has answers here:
Using regular expressions to validate a numeric range
(11 answers)
javascript regex optional minus
(1 answer)
Closed 2 years ago.
my question is, how to define a regular expression, if a range is between -50 to 50.
I have used this regular expression:
'\\b(-?[1-9]|-?[1-4][0-9]|-?50|[0-9])\\b'
but it can only check from 0 to 50
Why I use this pattern, because I use this pattern for input field such like this:
<inpit [pattern]="regex">
this pattern can only accept regex string
any solutions??
This question already has answers here:
What do ">>" and "<<" mean in Javascript?
(10 answers)
What does the ^ (caret) symbol do in JavaScript?
(5 answers)
What do these JavaScript bitwise operators do?
(3 answers)
What does this symbol mean in JavaScript?
(1 answer)
Closed 8 months ago.
I was going through a small program and i came across this syntax in javascript.
hash = Math.abs((hash << 2) ^ (hash + y))
please what does it mean?
hash was initially 0; i.e hash = 0;
This question already has answers here:
What is the explanation for these bizarre JavaScript behaviours mentioned in the 'Wat' talk for CodeMash 2012?
(5 answers)
Objects and arrays addition
(4 answers)
Closed 3 years ago.
Why is the result of the expression {}+[] 0?
It appears that the + is treated as a unary operator instead of a normal addition operator. The expression then becomes {}0. Why is this valid JavaScript and why is the result 0? Why is the object literal in the expression ({})+[] treated normally?
Note: I tried searching for a similar question in SO but it doesn't look like searching using symbols works.
This question already has answers here:
Pad a number with leading zeros in JavaScript [duplicate]
(9 answers)
How can I pad a value with leading zeros?
(76 answers)
Closed 3 years ago.
I'm not looking for simple template literals, more so the functionalities of String.format from java.
For example,
String.format("%05d",num);
if inputted 14, would output 00014. How could I do this in javascript?
This question already has answers here:
Why do regex constructors need to be double escaped?
(5 answers)
Regex created via new RegExp(myString) not working (backslashes)
(1 answer)
Javascript RegEx Not Working [duplicate]
(1 answer)
Closed 5 years ago.
I've created regex to parse football match score:
(0|[1-9]\d*\s)(:)(\s0|[1-9]\d*)
When I try:
let scoreRegex = new RegExp('(0|[1-9]\d*\s)(:)(\s0|[1-9]\d*)')
scoreRegex.exec('Team One 5 : 0 Team Two')
I get null instead of expected 3 groups. Any online parser out there validates my regex and matches the input string.
https://www.regextester.com/ +
https://regexr.com/ +
What am I missing?