Browse
For agents
About
CodePen Embed Block
/
trunk
CodePen Embed Block
vtrunk
Overview
Code
codepen-embed-block
/
src
/
utils
/
getPenID.js
getPenID.js
in CodePen Embed Block trunk, at src/utils/getPenID.js
9 lines
334 B
Find file
t
No matching file
Up and down to move
Enter to open
Esc to close
Raw
Download
Zip
View raw
1
export
default
function
getPenID
(
penURL
)
{
2
let
matches_array
=
penURL
.
match
(
3
/
http
[
s
]
?
:
\/
\/
codepen
\.
io
\/
(
?:
editor
\/
)
?
(
?:
team
\/
)
?
[
\w
-
]
+
\/
(
?:
pen
|
details
|
full
|
pres
|
debug
|
live
|
embed
)
\/
(
[
A-Z
-
a-z
0-9
\/
]
{32,}
|
[
A-Z
a-z
]
{5,8}
)
\/
?
/
4
)
;
5
return
Array
.
isArray
(
matches_array
)
?
matches_array
[
1
]
:
null
;
6
}
7
8
//
https://regex101.com/r/d8MV8q/1
9