html
html
1
<!-- no html -->
Enter to Rename, Shift+Enter to Preview
css
css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
body, html {
margin: 0;
}
.block {
margin: 5px;
padding: 5px;
line-height: 20px;
background-color: #33333309;
}
code {
background-color: #3332;
color: black;
padding: 2px;
border-radius: 4px;
}
Enter to Rename, Shift+Enter to Preview
js
js
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
/**
* context: this regex was made
* for Prism.js which had
* some bugs. Here i just
* tested it with a
* Bunch of test cases.
*
*/
// solved regex
var regex = /^((?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])*)+|0[bB](?:[01](?:_[01])*)+|0[oO](?:[0-7](?:_[0-7])*)+)n?|(?:\d(?:_\d)*)+n|NaN|Infinity)\b|(?:(?:\d(?:_\d)*)+\.?(?:\d(?:_\d)*)*|\.(?:\d(?:_\d)*)+)(?:[Ee][+-]?(?:\d(?:_\d)*)+)?)/;
// all the following test cases are true and regex should return them entirely
var validCases = [
"NaN",
"Infinity",
// hex
"0x09af",
"0x0ff_345_abc_def",
"0x0ff_fff_ff_ff_ffn",
"0xf_f_f_f_ffn",
"0xf_f_f_f_f",
"0X0ff_345_abc_def",
// binary
"0b100101",
"0b0011_11011_1111_011",
"0b1_1_1_1",
Enter to Rename, Shift+Enter to Preview
BROWSER
Console
Run