You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
ECMAScript proposal: RegExp flag /v makes character classes and character class escapes more powerful In this blog post, we look at the ECMAScript proposal “RegExp v flag with set notation + properties of strings” by Markus Scherer and Mathias Bynens. The new flag /v # The proposed new regular expression flag /v (.unicodeSets) enables three features: Support for multi-code-point graphemes (such a
Five years ago I posted Mimicking Lookbehind in JavaScript on this blog, wherein I detailed several ways to emulate positive and negative lookbehind in JavaScript. My approaches back then were all fairly rough, and it was complicated to properly customize any of them to work with a given pattern. Plus, they were only designed to simulate lookbehind in a regex-based replacement. To make it much eas
005D The interpretation of ECMAScript regular expression character classes is according to code units, not characters. Despite the fact that "[𝌆-𝍖]" contains 5 characters, since "[𝌆-𝍖]".length === 7, the meaning when used as a character class is surprising. "[𝌆-𝍖]" is equivalent to [\uD834\uDF06-\uD834\uDF56] and means "match either D834, or something in DF06‒D834, or DF56," just as if we ha
2008年05月30日17:15 カテゴリLightweight Languages javascript - String.prototype.quotemeta() があればいいんじゃね? 早い話、PerlにおけるquotemetaがあればOK、と。 文字列から正規表現を生成するときのメモ - IT戦記 という感じで、バックスラッシュをいっぱい書かなければいけないのでperldoc -f quotemeta quotemeta Returns the value of EXPR with all non-"word" characters backslashed. (That is, all characters not matching /[A-Za-z_0-9]/ will be preceded by a backslash in the returned string, reg
base2 のコードを見ていたら便利そうだったのでメモ http://code.google.com/p/base2/ 文字列から正規表現を作るとき RegExp("^hoge$"); // hoge とマッチ RegExp("^\\\\$"); // \ とマッチ RegExp("^\\[hoge\\]$"); // [hoge] とマッチ という感じで、バックスラッシュをいっぱい書かなければいけないので 以下のような関数を用意してやって function _r(str) { return (str + '').replace(/([\/()[\]{}|*+-.,^$?\\])/g, "\\$1"); } こんな感じで match(RegExp('^' + _r(prefix) + 'unko'), 'unko'); めもめも
Not all shorthand character classes and other JavaScript regex syntax is Unicode-aware. In some cases it can be important to know exactly what certain tokens match, and that's what this post will explore. According to ECMA-262 3rd Edition, \s, \S, ., ^, and $ use Unicode-based interpretations of whitespace and newline, while \d, \D, \w, \W, \b, and \B use ASCII-only interpretations of digit, word
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く