Soumettre la recherche
Mettre en ligne
Unicodeを触る
•
0 j'aime
•
129 vues
takenspc
Suivre
Node学園 41時目 書籍について で使用した発表資料です。 https://nodejs.connpass.com/event/275061/
Lire moins
Lire la suite
Logiciels
Signaler
Partager
Signaler
Partager
1 sur 15
Télécharger maintenant
Télécharger pour lire hors ligne
Recommandé
AngularJS+TypeScript - AngularJS 1周年記念勉強会
AngularJS+TypeScript - AngularJS 1周年記念勉強会
Masahiro Wakame
Haikara
Haikara
jewel12
Goでかんたんソースコードの静的解析
Goでかんたんソースコードの静的解析
Takuya Ueda
ng-japan 2015 TypeScript+AngularJS 1.3
ng-japan 2015 TypeScript+AngularJS 1.3
Masahiro Wakame
検索の工夫
検索の工夫
Keiichi Kobayashi
WebIDLを見てみる
WebIDLを見てみる
takenspc
アクセシビリティオブジェクトについて
アクセシビリティオブジェクトについて
takenspc
html5jアクセシビリティ部第0回勉強会
html5jアクセシビリティ部第0回勉強会
takenspc
Recommandé
AngularJS+TypeScript - AngularJS 1周年記念勉強会
AngularJS+TypeScript - AngularJS 1周年記念勉強会
Masahiro Wakame
Haikara
Haikara
jewel12
Goでかんたんソースコードの静的解析
Goでかんたんソースコードの静的解析
Takuya Ueda
ng-japan 2015 TypeScript+AngularJS 1.3
ng-japan 2015 TypeScript+AngularJS 1.3
Masahiro Wakame
検索の工夫
検索の工夫
Keiichi Kobayashi
WebIDLを見てみる
WebIDLを見てみる
takenspc
アクセシビリティオブジェクトについて
アクセシビリティオブジェクトについて
takenspc
html5jアクセシビリティ部第0回勉強会
html5jアクセシビリティ部第0回勉強会
takenspc
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Contenu connexe
En vedette
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
En vedette
(20)
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Unicodeを触る
1.
Unicodeを触る 2023-02-28 @takenspc
2.
最終的に話す内容 • 正規表現のvフラグ • ECMAScript
proposal: RegExp `v` flag with set notation + properties of strings • Stage 3 • V8 11.0/Google Chrome 112で利用可能
3.
https://github.com/tc39/proposal-regexp-v-flag
4.
今日の内容 •発表者の背景 •正規表現のuフラグで出来ること •正規表現のvフラグに期待すること
5.
発表者の背景 •書籍ではないものの文字やテキストを扱うことが多い • 文字が意図せず変わっていたり、意図しない文字がつかわれていたりする ことをチェックする機会がある •一次調査などで正規表現を使うことが多い
6.
正規表現のuフラグで出来ること •uフラグ /…正規表現…/ // uフラグなし /…正規表現…/u
// uフラグあり •uフラグでできること(の一部) • Unicodeの情報を使ってマッチ対象を表現
7.
例:「カタカナ」を探したい • /p{sc=Katakana}/u • UnicodeでScriptがKatakanaに分類される文字にマッチ •
一般的なカタカナの概念とは少し異なる • 半角カタカナ(アイウ)や組文字(㌱㌀㍇)、丸付き文字(㋐㋑㋒)などにも マッチする • 長音記号(ー)にはマッチしない • NFDや半角カタカナの濁点や半濁点にはマッチしない
8.
マッチ対象を増やすことはできる • /[p{sc=Katakana}u3099-u309Du30FCuFF9EuFF9FuFF70]/u • UnicodeでScriptがKatakanaに分類される文字と次のものにマッチ •
u3099-u309D: NFDなどの濁点・半濁点 • u30FC:長音記号 • uFF9EuFF9F:半角カタカナの濁点・半濁点 • uFF70:半角カタカナの長音記号
9.
マッチ対象を減らすには? •vフラグを使うと簡単に書ける
10.
正規表現のvフラグに期待すること • vフラグ /…正規表現…/ //
uフラグなし /…正規表現…/u // uフラグあり /…正規表現…/v // vフラグあり • vフラグでできること(の一部) • マッチ対象を減らせる
11.
例:原稿から意図せずコピーされる文字 • PowerPointなどで強制改行しているテキストをコピーすると改行が垂直タブ (U+000B)としてコピーされる • 某Webサービスのリッチテキストをコピーするとゼロ幅空白(U+200B)が入る …… 個別に対応していくと終わらないため、まとめて検索したい
12.
制御文字などを探したい •/p{gc=Other}/u • UnicodeでGeneral CategoryがOtherに分類される文字にマッチ •
この正規表現は実用しにくい • 空白やタブ、改行などにもマッチ • 絵文字で使われる制御用の文字(U+200D Zero Width Joiner)もマッチ
13.
マッチ対象を減らす • /[p{gc=Other}--[ trnu200D]]/v •
vフラグを使うとUnicodeでGeneral CategoryがOtherに分類される文字か ら--以降を除いてマッチ • 空白やタブ、改行などにはマッチしない • 絵文字で使われる制御用の文字(U+200D Zero Width Joiner)には マッチしない
14.
まとめ • 正規表現のuフラグ:Unicodeのプロパティを使ってマッチ対象を表現 • Unicodeのプロパティは要件と合わないこともあり、マッチ対象の調整が発生す ることも •
既存の正規表現でもマッチ対象を増やすことは可能 • vフラグを使うとマッチ対象を減らすことが可能 • 正規表現やUnicodeを上手く使ってテキストと付き合いたい
15.
参考 •ECMAScript proposal: RegExp
v flag with set notation + properties of strings •RegExp v flag with set notation and properties of strings · V8 •Unicode Utilities: Description and Index
Télécharger maintenant