Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
簡単な質問ですが、 "\$" で正規表現を使用する方法を知っている人はいますか? 基本的には、文字列を解析して、\$ の後に続く数値を見つけたいと考えています (たとえば、「新しいベッド フレームの購入で $50 オフ」)。
正規表現で$は、文字列の末尾を表すため、実際の $ に一致させたい場合は、. のように「エスケープ」する必要があります\$。
$
\$
Rでは、次のようgrepに を使用する必要があります。\\
grep
\\
x <- "Get $50 off on purchases of new bed frames" grep("\\$\\d+", x)