LoginSignup
1
1

More than 1 year has passed since last update.

(ボツ) #python や #ruby で 英単語全てにマッチする #正規表現 を書く例

Last updated at Posted at 2019-04-19

コメント欄参照


  • \b が単語境界

python

>>> import re
>>> re.findall(r'\b\w+\b', 'A whole new-World under_the_sea')
['A', 'whole', 'new', 'World', 'under_the_sea']

ruby

[4] pry(main)> "A Whole new-world under_the_sea".scan(/\b\w+\b/)
>>> ["A", "Whole", "new", "world", "under_the_sea"]

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

1
1
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1