Thông tin được tìm nạp bằng yêu cầu JSONP, yêu cầu này chứa văn bản quảng cáo và liên kết đến hình ảnh quảng cáo. Tệp JSON và hình ảnh được tìm nạp từ buysellads. com hoặc buysellads. bọc lưới
Nếu bạn có bất kỳ câu hỏi hoặc thắc mắc nào, xin vui lòng gửi email
Khi thử nghiệm thoát thuộc tính unicode, để xác định các chữ cái có dấu trong chuỗi, nó làm tôi nhớ đến một câu hỏi mà tôi đã có vài năm trước. cách tốt nhất để xác định và sau đó thay thế biểu tượng cảm xúc trong một chuỗi là gì?
Theo cách bạn có thể khớp các ký tự có dấu, bạn có thể sử dụng thoát thuộc tính unicode để khớp biểu tượng cảm xúc
const emojis = "😂😂💯".match[/\p{Emoji_Presentation}/gu]; // ["😂", "😂", "💯"]
Trước đây tôi đã thấy một mảng lớn của mọi biểu tượng cảm xúc từng được tạo và có thể
npm install emoji-regex2 không chứa tất cả biểu tượng cảm xúc trên tất cả các thiết bị, nhưng biểu thức chính quy này phù hợp với mọi trường hợp tôi gặp phải
emoji-regex cung cấp biểu thức chính quy để khớp với tất cả các biểu tượng và chuỗi biểu tượng cảm xúc [bao gồm cả biểu diễn văn bản của biểu tượng cảm xúc] theo Tiêu chuẩn Unicode. Nó dựa trên emoji-test-regex-pattern, tạo ra [tại thời điểm xây dựng] mẫu biểu thức chính quy dựa trên Tiêu chuẩn Unicode. Do đó, biểu tượng cảm xúc-regex có thể dễ dàng được cập nhật bất cứ khi nào biểu tượng cảm xúc mới được thêm vào Unicode
Cài đặt
Qua npm
npm install emoji-regex
trong nút. js
const emojiRegex = require['emoji-regex']; // Note: because the regular expression has the global flag set, this module // exports a function that returns the regex rather than exporting the regular // expression itself, to make it impossible to [accidentally] mutate the // original regular expression. const text = ` \u{231A}: ⌚ default emoji presentation character [Emoji_Presentation] \u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji \u{1F469}: 👩 emoji modifier base [Emoji_Modifier_Base] \u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier `; const regex = emojiRegex[]; for [const match of text.matchAll[regex]] { const emoji = match[0]; console.log[`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`]; }
Đầu ra bảng điều khiển
Matched sequence ⌚ — code points: 1
Matched sequence ⌚ — code points: 1
Matched sequence ↔️ — code points: 2
Matched sequence ↔️ — code points: 2
Matched sequence 👩 — code points: 1
Matched sequence 👩 — code points: 1
Matched sequence 👩🏿 — code points: 2
Matched sequence 👩🏿 — code points: 2
Dành cho người bảo trì
Cách cập nhật biểu tượng cảm xúc-regex sau khi phát hành Tiêu chuẩn Unicode mới
.
Chuyển sự phụ thuộc của emoji-test-regex-pattern sang phiên bản mới nhất
Cập nhật phần phụ thuộc dữ liệu Unicode trong
npm install emoji-regex
3 bằng cách chạy các lệnh sau# Example: updating from Unicode v13 to Unicode v14. npm uninstall @unicode/unicode-13.0.0 npm install @unicode/unicode-14.0.0 --save-dev
Tạo đầu ra mới
npm run build
Xác minh rằng các bài kiểm tra vẫn vượt qua
npm test
Cách xuất bản một bản phát hành mới
Trên nhánh
npm install emoji-regex
4, gõ số phiên bản biểu tượng cảm xúc-regex trongnpm install emoji-regex
3npm version patch -m 'Release v%s'
Thay vì
const emojiRegex = require['emoji-regex']; // Note: because the regular expression has the global flag set, this module // exports a function that returns the regex rather than exporting the regular // expression itself, to make it impossible to [accidentally] mutate the // original regular expression. const text = ` \u{231A}: ⌚ default emoji presentation character [Emoji_Presentation] \u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji \u{1F469}: 👩 emoji modifier base [Emoji_Modifier_Base] \u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier `; const regex = emojiRegex[]; for [const match of text.matchAll[regex]] { const emoji = match[0]; console.log[`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`]; }
1, hãy sử dụngconst emojiRegex = require['emoji-regex']; // Note: because the regular expression has the global flag set, this module // exports a function that returns the regex rather than exporting the regular // expression itself, to make it impossible to [accidentally] mutate the // original regular expression. const text = ` \u{231A}: ⌚ default emoji presentation character [Emoji_Presentation] \u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji \u{1F469}: 👩 emoji modifier base [Emoji_Modifier_Base] \u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier `; const regex = emojiRegex[]; for [const match of text.matchAll[regex]] { const emoji = match[0]; console.log[`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`]; }
2 hoặcconst emojiRegex = require['emoji-regex']; // Note: because the regular expression has the global flag set, this module // exports a function that returns the regex rather than exporting the regular // expression itself, to make it impossible to [accidentally] mutate the // original regular expression. const text = ` \u{231A}: ⌚ default emoji presentation character [Emoji_Presentation] \u{2194}\u{FE0F}: ↔️ default text presentation character rendered as emoji \u{1F469}: 👩 emoji modifier base [Emoji_Modifier_Base] \u{1F469}\u{1F3FF}: 👩🏿 emoji modifier base followed by a modifier `; const regex = emojiRegex[]; for [const match of text.matchAll[regex]] { const emoji = match[0]; console.log[`Matched sequence ${ emoji } — code points: ${ [...emoji].length }`]; }
3 nếu cầnLưu ý rằng điều này tạo ra một cam kết Git + thẻ
Đẩy cam kết phát hành và gắn thẻ
npm install emoji-regex
1CI của chúng tôi sau đó sẽ tự động xuất bản bản phát hành mới lên npm
Tác giả
Mathias BynenGiấy phép
biểu tượng cảm xúc-regex có sẵn theo giấy phép MIT